Fetch dynamic columns from table
571706Oct 15 2008 — edited Oct 15 2008I have table with 1000 rows and 200 columns. Columns have incremental suffix i.e
Table="X"
Columns=ID,A,B,C, D1,D2,D3....D200
I would like to get values from each column so i can process them accordingly.
OPEN c1 FOR SELECT * FROM X
LOOP
FETCH c1 BULK COLLECT INTO l_dies;
FOR indx IN 1 .. l_dies.COUNT
LOOP
FOR indx IN 0 .. 200
LOOP
colStr:=l_dies(indx).||'D'||indx; <-- Trying to concat dynamic column name but it gives error.
DBMS_OUTPUT.put_line('indx='|| indx || 'col value=' || colStr);
END LOOP;
END LOOP;
END LOOP;
This may not be the right way but just an example of what i would like to achieve.
Thanks in advance.