我有一个函数会返回一条 type 的记录my_table%ROWTYPE
,在调用者中,我可以检查返回的记录是否为空,但是 PL/SQL 抱怨 if 语句
PLS-00306:调用“IS NOT NULL”时参数的数量或类型错误
这是我的代码:
v_record my_table%ROWTYPE;
v_row_id my_table.row_id%TYPE := 123456;
begin
v_record := myfunction(v_row_id)
if (v_record is not null) then
-- do something
end if;
end;
function myfunction(p_row_id in my_table.row_id%TYPE) return my_table%ROWTYPE is
v_record_out my_table%ROWTYPE := null;
begin
select * into v_record_out from my_table
where row_id = p_row_id;
return v_record_out;
end myfunction;
谢谢。