When I am executing the package I get an error message:
error in the emp_test ORA-06530: Reference to uninitialized composite
Can u explain how I can initialized an object type in a package?
CREATE OR REPLACE TYPE emp_obj AS OBJECT
(
emp_no number,
salary number,
job varchar2(20)
);
CREATE OR REPLACE PACKAGE BODY emp_dummy_pk IS
PROCEDURE emp_test IS
CURSOR emp_cur IS
SELECT empno, sal, job FROM emp;
l_emp_no emp_obj;
BEGIN
FOR emp_rec IN emp_cur LOOP
l_emp_no.emp_no := emp_rec.empno;
l_emp_no.salary := emp_rec.sal;
l_emp_no.job := emp_rec.job;
BEGIN
emp_pk.emp_chk( p_emp_no => l_emp_no );
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( 'error in the emp_pk.emp_no ' || SQLERRM );
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( 'error in the emp_test ' || SQLERRM );
END;
END;
BEGIN
emp_dummy_pk.emp_test;
END;