在Oracle中,如果表值参数为null,则我想获取column的所有值,否则仅获取匹配的记录。
create or replace PROCEDURE pr_Employees (
lastnames IN LastName,
rowCursor OUT SYS_REFCURSOR) IS
BEGIN
Select * from emp where lastname in (
SELECT COLUMN_VALUE FROM TABLE(lastnames)
)
答案 0 :(得分:1)
尝试一下:
create or replace procedure pr_employees
( lastnames in lastname
, rowcursor out sys_refcursor )
is
begin
open rowcursor for
select * from emp
where lastname in
( select column_value from table(lastnames) )
or lastnames is empty;
end pr_employees;