Using Operator REF:
You can retrieve refs by using the operator REF that, like VALUE, takes as its argument a correlation variable. In the illustration below, you retrieve one or more refs to the Person objects, then insert the refs into the table person_refs:
BEGIN
INSERT INTO person_refs
SELECT REF(p) FROM persons p
WHERE p.last_name LIKE '%Smith';
In the later illustration, you retrieve a ref and attribute at similar time:
DECLARE
p_ref REF Person;
taxpayer_id VARCHAR2(9);
BEGIN
SELECT REF(p), p.ss_number INTO p_ref, taxpayer_id
FROM persons p
WHERE p.last_name = 'Parker'; -- must return one row
...
END;
In the final illustration, you update the attributes of a Person object:
DECLARE
p_ref REF Person;
my_last_name VARCHAR2(15);
...
BEGIN
...
SELECT REF(p) INTO p_ref FROM persons p
WHERE p.last_name = my_last_name;
UPDATE persons p
SET p = Person('Jill', 'Anders', '11-NOV-67', ...)
WHERE REF(p) = p_ref;
END;