My Stored procedure is like:
CREATE OR REPLACE PROCEDURE Proc_SearchRequests
(
RequestedBy LONG,
FromDate DATE DEFAULT NULL,
ToDate DATE DEFAULT NULL,
RequestedByDesignation VARCHAR2 DEFAULT NULL,
TypeId INT,
CurrentStatusId INT DEFAULT NULL,
AmountFrom LONG DEFAULT NULL,
AmountTo LONG DEFAULT NULL,
cur_ExcelOutput OUT SYS_REFCURSOR
)
AS
BEGIN
OPEN cur_ExcelOutput FOR
SELECT cd.*,
emp.FIRSTNAME || ' ' || emp.LASTNAME AS ADDEDBYNAME
FROM
DETAILS cd
LEFT JOIN EMPLOYEES emp ON cd.ADDEDBY = emp.EMPLOYEEID
WHERE
cd.TYPEID=TypeId;
END;
I am passing executing procedure as:
BEGIN
PROC_SEARCHREQUESTS (110, to_date ('2001-01-01', 'YYYY-MM-DD'), to_date ('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'), null, 2, 0, 0, 0, :cur_exceloutput$REFCURSOR);
END;
But whatever I pass as TypeId I get complete data and not the filtered one..
If i write “cd.TYPEID=2” I get proper result but passing value in varible is not helping.
What can be wrong?.. Am I missing any casting or something else?
You have name collision. The variable has the same name as column.
Change the variable(parameter)
into