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 -> Re: Newbie needs help with dynamic column name in SQL

Re: Newbie needs help with dynamic column name in SQL

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Sat, 16 Nov 2002 15:39:28 GMT
Message-ID: <QEtB9.19402$WL3.5506@rwcrnsc54>


bad design.
Jim
"K. C." <the_ada_at_hotmail.com> wrote in message news:be879ba7.0211160610.1d74da99_at_posting.google.com...
> Hi Martin,
>
> Ok. I have a table called tableA:
>
> ID NUMBER
> Fld1 VARCHAR2(20)
> Val1 VARCHAR2(500)
>
> Where ID has values from 1 to 20, and Fld1 and Val1 could be anything.
>
> Now, I have another table tableB:
>
> Col1 VARCHAR2(20)
> Fld1 VARCHAR2(500)
> Col2 VARCHAR2(20)
> Fld2 VARCHAR2(500)
> .
> .
> .
> Col20 VARCHAR2(20)
> Fld20 VARCHAR2(500)
>
> Bascially I want to move the data from tableA to tableB. In tableA,
> records with ID = 1 would go into the Col1 and Fld1 columns in tableB,
> records with ID = 2 would go into the Col2 and Fld2 columns in tableB.
>
> I'm using Oracle8i 8.1.6.
>
> Thanks,
> KC
>
> Martin Doherty <martin.doherty_at_elcaro.moc> wrote in message
news:<DRjB9.10$GH3.83_at_news.oracle.com>...
> > Is your table name or WHERE clause also dynamic? Because if it isn't I
> > don't see any point in updating the same rows 20 times in a loop - just
> > issue a single UPDATE that updates all 20 columns at the same time.
> >
> > Maybe you could expand a little bit on the business problem that is
> > causing you to ask the question, and possibly even mention the version
> > of Oracle you are working with (Yes, it DOES matter).
> >
> > Martin Doherty
> >
Received on Sat Nov 16 2002 - 09:39:28 CST

Original text of this message

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