I am facing a weird problem here.
PROCEDURE USL_EMPLOYEEBYID (
EMPLOYEE_ID IN NUMBER,
EMPIDCURSOR OUT SYS_REFCURSOR
)
AS
BEGIN
OPEN EMPIDCURSOR FOR
SELECT emp.employee_id,emp.employee_name,emp.present_address,emp.permanent_address,emp.status
FROM Employee_Info emp
WHERE emp.employee_id = EMPLOYEE_ID;
END;
This procedure should give me a single employee upon entering the employee Id. But it is returning all the employees.
What am I doing wrong here?
In your query, Oracle interprets
EMPLOYEE_IDas the columnEMPLOYEE_ID, not the input parameter, here you find something more; in this way, yourwherecondition is something likea=a.Change the parameter name to distinguish it from the table column:
this is a good practice, to always know in your code whether you are handling an input parameter, a local variable, a column and so on