Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic sql - variable as column name

lsaundersSep 9 2014 — edited Sep 25 2014

I'm trying to use the contents of a string variable to identify a column name in pl/sql. Is this possible?

In a collection, I have column c003 which contains the column name in a different collection, ie.. c001.

In my pl/sql, I am trying to retrieve that value and use it in a query, like this:

declare

date_col varchar2(5);

begin

select c003 into date_col from apex_collections where collection_name = 'MY_COLLECTION' and c004 = 'DATE';

-- date_col now contains 'c002'

for c1 in (select seq_id, **date_col** from apex_collections where collection_name = 'DATA_COLLECTION')

loop

-- process row

end loop;

end;

Is this possible?

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 23 2014
Added on Sep 9 2014
16 comments
5,855 views