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 -> Re: variables in sql-statements

Re: variables in sql-statements

From: Nuno Veiga Raposo <nuno.raposo_at_roff.pt>
Date: Wed, 13 Jun 2001 11:47:58 +0100
Message-ID: <9g7goe$mc6$1@venus.telepac.pt>

Hello Simon!

I guess you cannot declare a table as a variable. But I may be mistaken...

Nuno Raposo

"Simon Schrammel" <ssh_at_tetrag.ch> wrote in message news:dcFV6.101$io1.504326_at_news...
> Hello
>
> I am creating a script which uses variables. I store the table-names in
> these variables and I need to uses these variables in sql-statements. How
> does this work in orcacle?
>
> example:
>
> declare
> tab_name varchar2(20);
> col_name varchar2(20);
>
> begin
> tab_name:='labor';
> col_name:='name';
>
> select * from tab_name where col_name='ROM34';
>
> end;
>
>
> ERRORS:
> ORA-06550: line 7, column 15:
> PLS-00356: 'TAB_NAME' must name a table to which the user has access
> ORA-06550: line 7, column 1:
> PL/SQL: SQL Statement ignored
>
>
> Thank you for your help.
>
> Simon
>
>
Received on Wed Jun 13 2001 - 05:47:58 CDT

Original text of this message

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