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: runtime tablenames in stored procedure.

Re: runtime tablenames in stored procedure.

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Tue, 18 Jan 2000 12:30:13 +0100
Message-ID: <948195118.15132.0.pluto.d4ee154e@news.demon.nl>


You need to use the dbms_sql package.

Hth,

--
Sybrand Bakker, Oracle DBA
<kagopi_at_my-deja.com> wrote in message news:8606p2$156$1_at_nnrp1.deja.com...
> Hi all,
>
> Is there a way to provide the table names to a stored
> procedure at runtime.. ?
>
> I would like to select say, 'login_name' from 3 different
> tables and use them in a similar way, but the table names
> should be flexible enough to be determined at runtime.
>
> I have the code below, but it wouldn't
> compile.
>
> replace.sql
> ***************************************set echo on
> create or replace procedure ReplaceLoginNamesWithEmpId(
> table_name in char,
> handle_mgr in char)
> as
> begin
> declare
> cursor ID_CURSOR is
> select otheruserid,login_name
> from known_users,table_name
> where login_name = known_users.web_username ;
> empid varchar(200);
> logname varchar(200);
>
> begin
> open ID_CURSOR;
> for curs_id_rows in id_cursor
> loop
> fetch ID_CURSOR into empid,logname;
> -- insert into dummy_copy values(empid);
> end loop;
> commit;
> end;
> end;
> ****************************************************
>
>
> please cc to kagopi_at_hotmail.com.
>
> thanks,
> gopinath
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Jan 18 2000 - 05:30:13 CST

Original text of this message

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