Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Newbie needs help with dynamic column name in SQL
Hi,
I have a table with 20 columns like this:
Field1, Field2, Field3....Field20
I want to do this:
i:=1;
WHILE i<=20 LOOP
fldname:='Field' || TO_CHAR(i);
UPDATE table1
SET fldname = 'ABC' <--- fldname would be field1 to field 20
WHERE blah blah blah;
i:=i+1;
END LOOP
Is it possible to do this? How do I change the field name dynamically?
Thanks in advance.
KC Received on Fri Nov 15 2002 - 20:43:13 CST