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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Tablename variable. How To?

Re: Tablename variable. How To?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 20 Jul 1999 21:40:07 +0800
Message-ID: <37947C37.540B@yahoo.com>


Kenneth Herskedal wrote:
>
> I have a table name stored in a CHAR(15). I want to performe a select
> statement on this table.
>
> How can I use this variable in the SQL?
>
> tt char(15)
> ..
> fetch stat into tt;
> select * from tt; -- Not working!!
>
> Thanks in advance.

In oracle 7, you need to use dbms_sql.

(To see how, do

select text
from dba_source
where name = 'DBMS_SQL'
and type = 'PACKAGE'
order by line

In oracle8, check out "execute_immediate"

HTH
--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Tue Jul 20 1999 - 08:40:07 CDT

Original text of this message

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