¿Cómo comprobar si el cursor devuelve algún registro en Oracle?
Tengo un siguiente procedimiento almacenado en el que he usado un cursor. Dependiendo de si el cursor devuelve algún registro o no, necesito hacer algún procesamiento.
Pero no estoy seguro de cómo comprobar si el cursor devuelve algún registro.
CREATE OR REPLACE PROCEDURE SP_EMPLOYEE_LOOKUP_BY_EMP_ID
(
IN_USER_ID IN NUMBER,
IN_EMPLOYEE_ID NUMBER,
IN_HC_AS_ON_DATE VARCHAR2,
emp_cursor OUT SYS_REFCURSOR
)
IS
CURSOR employees IS
SELECT * FROM EMPLOYEE e;
BEGIN
if(record exist ) then
FOR employee IN employees
LOOP
// do something
END LOOP;
else if employees is empty then
// do something else
END;