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

Home -> Community -> Usenet -> c.d.o.tools -> SQL Question

SQL Question

From: <lsleve_at_my-deja.com>
Date: Thu, 14 Dec 2000 22:09:48 GMT
Message-ID: <91bgf7$h7n$1@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/ Received on Thu Dec 14 2000 - 16:09:48 CST

Original text of this message

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