PL/SQL (MOSC)

MOSC Banner

Using TREAT function on dangling REF in PL/SQL raises uncatchable ORA-21700 exception

edited Jan 24, 2011 8:54AM in PL/SQL (MOSC) 4 commentsAnswered ✓
Hello all,

The following code demonstrates the situation summarized by the subject line:

create or replace type TMyObject
is object
(
 id integer
)
/

create or replace view V_My_Object
of TMyObject
with object identifier (id)
as
select new TMyObject(1234)
from DUAL
/

set serveroutput on

declare
 valid_id integer  := 1234;
 invalid_id integer  := 1000;

 r  ref TMyObject;
 i  TMyObject;
begin
 --
 -- Notice that using UTL_REF.Select_Object on the invalid REF raises ORA-21700, but that the exception is caught
 --

 select make_ref(V_My_Object, valid_id)
 into r
 from DUAL;

 begin
  UTL_REF.Select_Object(r, i);

  dbms_output.put_line(i.id);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center