How to execute stored procedure with output parameter?
955649Sep 24 2012 — edited Sep 24 2012Hi all,
Hope doing well,
sir i am using one stored procedure which is using output parameter,
here is my stored procedure below:
CREATE OR REPLACE PROCEDURE Spvalidateholiday1
(
v_pidate1 IN DATE DEFAULT NULL ,
v_piEmpid IN VARCHAR2 DEFAULT NULL ,
v_pidate2 IN DATE DEFAULT NULL ,
v_poRetVal OUT integer
)
--RETURN NUMBER
AS
v_date3 VARCHAR2(20);
v_date4 VARCHAR2(20);
v_date5 VARCHAR2(40);
v_date6 VARCHAR2(40);
v_scode VARCHAR2(10);
v_dayoff1 VARCHAR2(20);
v_dayoff2 VARCHAR2(20);
BEGIN
v_date5 := To_Date(v_pidate1,'WW') ;
v_date6 := To_Date(v_pidate2,'WW') ;
SELECT Shift_Code
INTO v_scode
FROM Employee
WHERE Emp_ID = v_piEmpid;
SELECT WeeklyOff1
INTO v_dayoff1
FROM Shift
WHERE Shift_Code = v_scode;
SELECT WeeklyOff2
INTO v_dayoff2
FROM Shift
WHERE Shift_Code = v_scode;
SELECT dayid
INTO v_date3
FROM Weekly
WHERE dayss = v_dayoff1;
SELECT dayid
INTO v_date4
FROM Weekly
WHERE dayss = v_dayoff2;
--select @date3=dayid from Weekly w join Site_Param s on w.dayss=s.WeeklyOff1
--select @date4=dayid from Weekly w join Site_Param s on w.dayss=s.WeeklyOff2
IF ( v_date5 = v_date3
OR v_date6 = v_date4
OR v_date4 = v_date5
OR v_date3 = v_date6 ) THEN
BEGIN
v_poRetVal := 0 ;
END;
ELSE
BEGIN
v_poRetVal := 1 ;
END;
END IF;
RETURN; --v_poRetVal;
END;
please check that is it correct.
when i am calling throgh application it's showing error invalid month.
here i am executing this stored procedure manually.
BEGIN
spvalidateholiday1 ('09/12/2012 00:00:00','00000002','09/14/2012 00:00:00', 1);
END;
but it's not executing some error is coming
error is "expression 1 cannot be used as an assignment target statement ignored."
am i doing anything wrong??
please help me.
thanks