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: K. C. <the_ada_at_hotmail.com>
Date: 17 Nov 2002 19:00:07 -0800
Message-ID: <be879ba7.0211171900.5b8a4f20@posting.google.com>


Hi,

No, it's not some kind of homework. As mentioned in my previous message, we currently have tableA in our database. We need to update tableB with tableA's data every night (as a batch job) because we would like to allow certain users to dump their data to an Excel spreadsheet. These users have no clue how to link tables or do SQL. All they need to do is click a button and have their data dumped into a spreadsheet format (with 20 columns).

I hope this clears things up.

Thanks,
KC

Martin Doherty <martin.doherty_at_elcaro.moc> wrote in message news:<3nVB9.3$C_6.24_at_news.oracle.com>...
> KC, you have expanded on the technical problem (thanks), but you did not
> mention the business problem that is driving you to even attempt this
> activity. As Jim pointed out, it looks like you are de-normalizing your
> data, which may or may not be a bad move depending on how you plan to
> make use of it. Is this an actual business problem, or an artificial
> problem dreamed up by your lecturer? How about backing up a few steps
> and telling us the original problem you are trying to solve? There may
> be far better alternatives than the particular approach you have decided
> to wrestle with.
>
> Martin Doherty
>
> Jim Kennedy wrote:
>
> >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 Sun Nov 17 2002 - 21:00:07 CST

Original text of this message

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