I've created a table type to pass multiple employee id's to my procedure. However, there is a requirement of, if nothing is passed to input parameter then all the employees should be retrieved.
Table type created -
CREATE OR REPLACE TYPE EMP_LIST IS TABLE OF NUMBER;
I wrote below query to check the null value but it failed with error - ORA-01427: single-row subquery returns more than one row
SELECT COL_LIST FROM EMP
WHERE EMP_ID IN (CASE WHEN (SELECT COLUMN_VALUE FROM table(EMP_LIST())) IS NULL
THEN (SELECT EMP_ID FROM EMP)
ELSE (SELECT COLUMN_VALUE FROM table(EMP_LIST())) END)
CASE cannot return multiple values. Could someone please suggest an alternative or any other solution to handle such scenario?
Thank You.
emp_listshould be namednumber_list. - William Robertson