| PL/SQL Packages and Types Reference 10g Release 1 (10.1) Part Number B10802-01 |
|
|
View PDF |
An ANYTYPE TYPE can contain a type description of any persistent SQL type, named or unnamed, including object types and collection types. It can also be used to construct new transient type descriptions.
New persistent types can only be created using the CREATE TYPE statement. Only new transient types can be constructed using the ANYTYPE interfaces.
Thios chapter discusses the following:
This procxedure creates a new instance of ANYTYPE which can be used to create a transient type description.
STATIC PROCEDURE BEGINCREATE( typecode IN PLS_INTEGER, atype OUT NOCOPY ANYTYPE);
This procedure sets any additional information required for constructing a COLLECTION or builtin type.
MEMBER PROCEDURE SETINFO( self IN OUT NOCOPY ANYTYPE, prec IN PLS_INTEGER, scale IN PLS_INTEGER, len IN PLS_INTEGER, csid IN PLS_INTEGER, csfrm IN PLS_INTEGER, atype IN ANYTYPE DEFAULT NULL, elem_tc IN PLS_INTEGER DEFAULT NULL, elem_count IN PLS_INTEGER DEFAULT 0);
DBMS_TYPES.INVALID_PARAMETER: Invalid Parameters (typecode, typeinfo)DBMS_TYPES.INCORRECT_USAGE: Incorrect usage (cannot call after calling ENDCREATE, and similar actions.)It is an error to call this function on an ANYTYPE that represents a persistent user defined type.
This procedure adds an attribute to an ANYTYPE (of typecode DBMS_TYPES.TYPECODE_OBJECT).
MEMBER PROCEDURE ADDATTR( self IN OUT NOCOPY ANYTYPE, aname IN VARCHAR2, typecode IN PLS_INTEGER, prec IN PLS_INTEGER, scale IN PLS_INTEGER, len IN PLS_INTEGER, csid IN PLS_INTEGER, csfrm IN PLS_INTEGER, attr_type IN ANYTYPE DEFAULT NULL);
DBMS_TYPES.INVALID_PARAMETERS: Invalid Parameters (typecode, typeinfo)DBMS_TYPES.INCORRECT_USAGE: Incorrect usage (cannot call after calling EndCreate, and similar actions.)This procedure ends creation of a transient ANYTYPE. Other creation functions cannot be called after this call.
MEMBER PROCEDURE ENDCREATE( self IN OUT NOCOPY ANYTYPE);
| Parameter | Description |
|---|---|
|
|
The transient |
This procedure returns an ANYTYPE corresponding to a persistent type created earlier using the CREATE TYPE SQL statement.
STATIC FUNCTION GETPERSISTENT( schema_name IN VARCHAR2, type_name IN VARCHAR2, version IN VARCHAR2 DEFAULT NULL) RETURN ANYTYPE;
| Parameter | Description |
|---|---|
|
|
Schema name of the type. |
|
|
Type name. |
|
|
Type version. |
An ANYTYPE corresponding to a persistent type created earlier using the CREATE TYPE SQL statement.
This function gets the type information for the ANYTYPE.
MEMBER FUNCTION GETINFO ( self IN ANYTYPE, prec OUT PLS_INTEGER, scale OUT PLS_INTEGER, len OUT PLS_INTEGER, csid OUT PLS_INTEGER, csfrm OUT PLS_INTEGER, schema_name OUT VARCHAR2, type_name OUT VARCHAR2, version OUT varchar2, count OUT PLS_INTEGER) RETURN PLS_INTEGER;
The typecode of self.
DBMS_TYPES.INVALID_PARAMETERS: Invalid Parameters (position is beyond bounds or the ANYTYPE is not properly Constructed).This function gets the type information for an attribute of the type (if it is of TYPECODE_OBJECT). Gets the type information for a collection's element type if the self parameter is of a collection type.
MEMBER FUNCTION GETATTRELEMINFO ( self IN ANYTYPE, pos IN PLS_INTEGER, prec OUT PLS_INTEGER, scale OUT PLS_INTEGER, len OUT PLS_INTEGER, csid OUT PLS_INTEGER, csfrm OUT PLS_INTEGER, attr_elt_type OUT ANYTYPE aname OUT VARRCHAR2) RETURN PLS_INTEGER;
The typecode of the attribute or collection element.
DBMS_TYPES.INVALID_PARAMETERS: Invalid Parameters (position is beyond bounds or the ANYTYPE is not properly constructed).