The following SQL is trying to select some values, where it satisfies the condition that
select cd as key_type, decode
from general_code
where key_type = 'A_MAP_TYPE'
and cd in (
select distinct(A_MAP_TYPE)
from sales_channel
);
A_MAP_TYPE is a column name (and FK) in table sales_channel, and it is being referenced in general_code (as PK).
I realize that this SQL is non portable in that when the name of A_MAP_TYPE changes, i.e. to B_MAP_TYPE, then the corresponding SQL needs to be changed. Is there a way to do something like PL/SQL's TABLE_NAME.COLUMN_NAME%TYPE in this SQL?