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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to create cursor inside begin/end block in pl/sql

RE: How to create cursor inside begin/end block in pl/sql

From: Guang Mei <GMei_at_ph.com>
Date: Tue, 5 Dec 2006 14:48:44 -0500
Message-ID: <99965A782DFBA44EB9F773211FFC9DE607C18414@phexchange2.ph.com>


yes, use dynamic sql  

Guang

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Harvinder Singh Sent: Tuesday, December 05, 2006 2:42 PM To: oracle-l
Subject: How to create cursor inside begin/end block in pl/sql

Hi,  

We have a requirement that depending upon the input parameter passed we have to declare the cursor accordingly.

For example like the following code:  

create or replace procedure test(dummy int)

as

begin

if (dummy=1)

then

cursor c1 is select id_acc from tab1;

else

cursor c1 is select id_acc from tab2;

end if;

end;  

Is it possible to do like this and how to fix this code?  

Thanks

--Harvinder
 

--

http://www.freelists.org/webpage/oracle-l Received on Tue Dec 05 2006 - 13:48:44 CST

Original text of this message

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