Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Newbie needs help with dynamic column name in SQL

Newbie needs help with dynamic column name in SQL

From: K. C. <the_ada_at_hotmail.com>
Date: 15 Nov 2002 18:43:13 -0800
Message-ID: <be879ba7.0211151843.2c58bd73@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US