Create (anonymous) transient type with two attributes: number, date : DBMS_TYPES « System Packages « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> CREATE OR REPLACE FUNCTION create_a_type
  2     RETURN ANYTYPE
  3  AS
  4     myany ANYDATA;
  5     mytype ANYTYPE;
  6  BEGIN
  7     ANYTYPE.BeginCreate(typecode => DBMS_TYPES.TYPECODE_OBJECT, atype => mytype);
  8     mytype.AddAttr(typecode => DBMS_TYPES.TYPECODE_NUMBER, aname => 'just_a_number',
  9        prec => 38, scale => 0, len => NULL, csid => NULL, csfrm => NULL);
 10     mytype.AddAttr(typecode => DBMS_TYPES.TYPECODE_DATE, aname => 'just_a_date',
 11        prec => NULL, scale => NULL, len => NULL, csid => NULL, csfrm => NULL);
 12     mytype.EndCreate;
 13     RETURN mytype;
 14  END;
 15  /

Function created.

SQL>
SQL> SHOW ERRORS
No errors.
SQL>








31.29.DBMS_TYPES
31.29.1.Create (anonymous) transient type with two attributes: number, date