Object References (Cont.)


Three Operators

SQL> SET SERVEROUTPUT ON; 

SQL> DECLARE 
  2    v_person           person_typ; 
  3    v_person_ref  REF  person_typ; 
  4  BEGIN 
  5    SELECT  REF( p )  INTO  v_person_ref 
  6      FROM  persons p  WHERE  p.ssn = 123456789; 
  7    SELECT  DEREF( v_person_ref )  INTO  v_person  FROM  dual; 
  8    DBMS_OUTPUT.PUT_LINE ( v_person.name ); 
  9  END; 
 10  / 

PowerPuff Girls
PL/SQL procedure successfully completed.