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: SQL Question

Re: SQL Question

From: <aqs472_at_my-deja.com>
Date: Fri, 15 Dec 2000 16:20:18 GMT
Message-ID: <91dgbo$3f1$1@nnrp1.deja.com>

I believe lsleve's problem is much more than this. You need to brush up on your SQL lsleve.

Cheers.

In article
<2B0E5EBF82AFEE85.3D1AA72D9663EC6A.754B6201424505AB_at_lp.airnews.net>,   "Sean Emery" <emerys_at_remove_me_jagunet.com> wrote:
> You will need to use dynamic sql to accomplish this. You must build
 the sql
> statement as a varchar2 and
> either use execute immediate in Oracle 8i or DBMS_SQL package in
 previous
> versions.
>
> This should get you going in the right direction.
>
> <lsleve_at_my-deja.com> wrote in message news:91bgf7
 $h7n$1_at_nnrp1.deja.com...
> > Considering the following example;
> >
> > create table mytables (
> > table_nameschar(20),
> > reference char(30));
> > /
> > insert into mytables values
> > ('TableX','first');
> > /
> > insert into mytables values
> > ('TableY', 'second');
> > /
> > create tableTableX (
> > C1 char(20));
> > /
> > insert into TableX values
> > ('Oracle Corporation');
> > /
> >
> > I need a single query that will extract a tablename from the
 mytables
> > field and shove it into a select statement with the from table being
> > the result of the query on mytables. I attempted the following to
> > acomplish this:
> > select C1 from (select table_names from mytables where reference
> > = 'first');
> >
> > This produced the following output:
> > select C1 from (selecttable_names from mytables where reference
> > = 'first')
> > *
> > ERROR at line1:
> > ORA-00904: invalid column name
> >
> > How is this accomplished and what did I do wrong?
> >
> > LSleve
> >
> >
> >
> >
> >
> > Sent via Deja.com
> > http://www.deja.com/
>
>

Sent via Deja.com
http://www.deja.com/ Received on Fri Dec 15 2000 - 10:20:18 CST

Original text of this message

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