Re: table name substitution in pl/sql

From: Frans H. <fransh_at_hotmail.com>
Date: 5 Oct 2003 23:56:50 -0700
Message-ID: <31abf0e5.0310052256.66260397_at_posting.google.com>


sureshcb_at_yahoo.com (Suresh) wrote in message news:<2af7b65c.0310011322.43ad7aaf_at_posting.google.com>...
> how can we use a variable in the place of a tablename?
>
> towner=scott
> ttable_name=emp
> select count(*) into totrows from towner.ttable_name;
>
> ERROR at line 18:
> ORA-06550: line 18, column 49:
> PLS-00201: identifier 'TOWNER.TTABLE_NAME' must be declared
> ORA-06550: line 18, column 15:
> PL/SQL: SQL Statement ignored
>
> I need to substitute different table names. How do I pass variable
> names as table names? Towner and ttable_names are declared in the
> declare section.
>
> Thanks
>
> Suresh

Suresh,

Use a REF_CURSOR.

Frans H. Received on Mon Oct 06 2003 - 08:56:50 CEST

Original text of this message