Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Cursor with schema name change

Re: Cursor with schema name change

From: vipan <dba_at_no_spam.netscape.net>
Date: Tue, 16 Sep 2003 10:21:21 +0530
Message-ID: <3F6696C9.8040408@no_spam.netscape.net>


Hi,

You can use dynamic sql or native sql(using execute immediate) for this.

Thanks

Linda Lee wrote:
> I have two procedures that use a cursor to get data from two tables of
> same structure, but different accounts:
>
> create or replace procedure test1 as
> cursor c1
> select firstname from USER1.emp
> where dept = '01';
> begin
> for l in c1 loop
> ...
> end loop;
> end;
>
> create or replace procedure test2 as
> cursor c1
> select firstname from USER2.emp
> where dept = '01';
> begin
> for l in c1 loop
> ...
> end loop;
> end;
>
> How can I write one procedure to do the same thing, and pass the
> schema name(USER1 or USER2) as a variable to call the procedure?
>
> Thank you very much for your help.
Received on Mon Sep 15 2003 - 23:51:21 CDT

Original text of this message

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