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

Re: Dinamic SQL

From: Curtis Holbrook <cholbroo_at_concentric.net>
Date: 25 Oct 1999 08:31:40 PDT
Message-ID: <3814790B.FB1D5927@concentric.net>


I agree that the first method will work in SQL*Plus, but the second method won't. Trying to use a variable in place of a table name in an embedded SQL statement will generate a compiler error. You must use dynamic SQL. What environment are you using: SQL*Plus, Pro-C, OCI??

TurkBear wrote:
>
> How are you planning to execute the select statement...
>
> If from SqlPLus than you can write a script the has:
>
> Select * from &tablename
>
> It will prompt you for a table name when run...
>
> with other methods, assign the tablename to a string variable ( varchar2 for
> example and use it like
> select * from :tablename variable
>
> "Starman" <ninomail_at_tin.it> wrote:
>
> >Hi all,
> >
> >I need to execute a SELECT statement but I want the "FROM table" variable.
> >
> >for ex. : SELECT * FROM <tablename>;
> >
> >where tablename is a variable.
> >
> >Is it possible? If not, is there another way?
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
Received on Mon Oct 25 1999 - 10:31:40 CDT

Original text of this message

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