ANYTYPE Demo : ANYTYPE « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL> CREATE OR REPLACE FUNCTION create_an_instance (which_type IN ANYTYPE,
  2     att1 IN NUMBER DEFAULT 0, att2 IN DATE DEFAULT SYSDATE)
  3     RETURN ANYDATA
  4  AS
  5     l_type ANYTYPE := which_type;
  6     l_any ANYDATA;
  7  BEGIN
  8     ANYDATA.BeginCreate(dtype => l_type, adata => l_any);
  9     l_any.SetNumber(num => att1);
 10     l_any.SetDate(dat => att2);
 11     l_any.EndCreate;
 12     RETURN l_any;
 13  END;
 14  /

Function created.

SQL>
SQL> SHOW ERRORS
No errors.
SQL>








21.39.ANYTYPE
21.39.1.ANYTYPE Demo