Description:

Does anyone out there have a function that will return elcode from eo_id, or element_subnational_id?


Cause:

Yes. A function to return elcode_bcd from an EO is attached to this article.


In SQL+, logged on as the biotics_user, copy and paste the code and hit enter. You should get 'Function created'.
You would use the function like this:
select eo.eo_id, eo_elcode(eo.eo_id), dr.basic_eo_rank_cd
from eo, d_basic_eo_rank dr
where eo.d_basic_eo_rank_id = dr.d_basic_eo_rank_id and
dr.basic_eo_rank_cd like 'A%' or
dr.basic_eo_rank_cd like 'B%';


This will show you the eo_id, elcode and rank for any A-ish or B-ish ranked EOs.


To get the elcode from an element subnational id, you can use the est_elcode function, which is already in your database (it's used by the Exchanger).
select est_elcode(est.element_subnational_id)
from element_subnational est
where
yada, yada yada....