Skip to Main Content

SQL & PL/SQL

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 Column name in a Cursor

720285Jul 14 2010 — edited Jul 23 2010
Hello there,
How can I access data in cursor's field with dynamic fields names, more illustration follows:

My table has columns named as C1,C2,C3 so on
defined a cursor cursor_name on that table,
I need to access the fields by a loop like this:

OPEN cursor_name;
Fetch cursor_name into rec;
for i in 1 .. 10 loop
if rec.ci = 1Then
.....
end if;

end loop
close cursor_name;

where rec,ci represents the name of the cursor fields, so that I loop over them,

how can I implement such an idea,
thanks in advance

regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2010
Added on Jul 14 2010
5 comments
3,269 views