Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> how to loop through fields in cursor?
Hi,
Is there a way to access cursor column by its position not by its name?
I have opened cursor with over 200 fields and I would like to loop through
it and get the value of each field into the separate index of tabletype
variable.
Right now I have some dreadful code :
OPEN C FOR SQLSTRING;
LOOP
FETCH C INTO W(1), W(2), ...... and so on up to W(200);
EXIT WHEN C%NOTFOUND;
... do something
END LOOP;
Taking into consideration this cursor can consist of 500 fields next month
(for example) it woud be better to
OPEN C FOR SQLSTRING;
LOOP
FETCH C INTO some%rowtype_variable;
for i in 1 .. total_number_of_fields W(i) := some%rowtype_variable.fields(i) end loop;
Thanks in advance for any help.
Regards,
Wojtek
Received on Fri Jun 04 2004 - 07:48:50 CDT