Re: variables in sql-statements

From: Oleg Fedorov <OFederov_at_hds-mckhboc.com>
Date: Sat, 21 Jul 2001 21:51:53 GMT
Message-ID: <1b18fb6a.0106131306.3b2b17a8_at_posting.google.com>


Hi,

You can use DBMS_SQL or native dynamic SQL (Oracle 8i).

"Simon Schrammel" <ssh_at_tetrag.ch> wrote in message news:<U2FV6.99$io1.504264_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 Sat Jul 21 2001 - 23:51:53 CEST

Original text of this message