有没有办法比较Oracle中自定义的记录结构?我正在尝试=
和!=
但我唯一得到的是编译时错误
PLS-00306:调用' ='
时参数的数量或类型错误PLS-00306:调用'!='
时参数的数量或类型错误
实施例
type my_type is record (
a varchar2(6),
b varchar2(6)
);
rec1 my_type;
rec2 my_type;
begin
if rec1 = rec2 then
null;
end if;
if rec1 != rec2 then
null;
end if;
end;
答案 0 :(得分:2)
**Record Comparisons**
Records cannot be tested natively for nullity, equality, or inequality. These BOOLEAN expressions are illegal:
My_Record IS NULL
My_Record_1 = My_Record_2
My_Record_1 > My_Record_2
You must write your own functions to implement such tests. For information about writing functions, see Chapter 8, "PL/SQL Subprograms."