To compare record values, perform a field-by-field comparison:
SQL> SQL> drop table emp; Table dropped.-- w w w .j a v a 2 s. co m SQL> SQL> SQL> create table emp( 2 empno number(4,0), 3 ename varchar2(10), 4 job varchar2(9), 5 mgr number(4,0), 6 hiredate date, 7 sal number(7,2), 8 comm number(7,2), 9 deptno number(2,0) 10 ); Table created. Elapsed: 00:00:00.00 SQL> SQL> insert into emp values(7369, 'KING', 'PRESIDENT', null, to_date('17-11-1981','dd-mm-yyyy'), 5000, null, 10); SQL> insert into emp values(7698, 'BLAKE', 'MANAGER', 7839,to_date('1-5-1981','dd-mm-yyyy'), 2850, null, 30); SQL> SQL> create or replace function f_isDuplicate_yn(i_emp1_rec emp%ROWTYPE, i_emp2_rec emp%ROWTYPE) 2 return VARCHAR2 3 is 4 v_out_tx VARCHAR2(1):='N'; 5 begin 6 if i_emp1_rec.eName=i_emp2_rec.eName 7 and i_emp1_rec.mgr=i_emp2_rec.mgr 8 and i_emp1_rec.deptNo=i_emp2_rec.deptNo 9 then 10 v_out_tx:='Y'; 11 end if; 12 return v_out_tx; 13 end; 14 / Function created. Elapsed: 00:00:00.04 SQL> SQL> SQL>