how to declare cursor in procedure based on if condition?
877377Mar 14 2012 — edited Mar 14 2012Hi Experts,
In sql server I have eprocedure in which I declare cursor like this:
IF (@int_cntCondition = 1 )
BEGIN
DECLARE Date_Cursor CURSOR FOR select HolidayCcy,HolidayDate from Definition..HolidayCalendar WITH (NOLOCK) where
HolidayCcy in (@Deposit_Currency,@Alternate_Currency)
AND CONVERT(SMALLDATETIME,CONVERT(VARCHAR(25),HolidayDate,106)) >=
CONVERT(SMALLDATETIME,CONVERT(VARCHAR (25),@T_Date,106))
END
ELSE
BEGIN
DECLARE Date_Cursor CURSOR FOR select HolidayCcy,HolidayDate from Definition..HolidayCalendar WITH (NOLOCK) where
HolidayCcy in (@Deposit_Currency,@Alternate_Currency,@Bank_Base_Currency)
AND CONVERT(SMALLDATETIME,CONVERT(VARCHAR(25),HolidayDate,106)) >=
CONVERT(SMALLDATETIME,CONVERT(VARCHAR(25),@T_Date,106))
END
I have to declare same cursor in oracle based on 'if' condition.
But in oracle stored procedur cursor has to declare outside of Begin statment of procedure, so how can I declare This cursor in Orracle?
if anyone know about it, Plese help or send any link to refer.
Thanks.