Skip Headers

Oracle9i Supplied PL/SQL Packages and Types Reference
Release 2 (9.2)

Part Number A96612-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

ANYTYPE TYPE, 2 of 2


Summary of ANYTYPE Subprograms

Table 105-1 ANYTYPE Subprograms
Subprogram Description

BEGINCREATE Static Procedure

Creates a new instance of ANYTYPE which can be used to create a transient type description.

SETINFO Member Procedure

Sets any additional information required for constructing a COLLECTION or builtin type.

ADDATTR Member Procedure

Adds an attribute to an ANYTYPE (of typecode DBMS_TYPES.TYPECODE_OBJECT).

ENDCREATE Member Procedure

Ends creation of a transient AnyType. Other creation functions cannot be called after this call.

GETPERSISTENT Static Function

Returns an AnyType corresponding to a persistent type created earlier using the CREATE TYPE SQL statement.

GETINFO Member Function

Gets the type information for the AnyType.

GETATTRELEMINFO Member 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.

BEGINCREATE Static Procedure

This procxedure creates a new instance of ANYTYPE which can be used to create a transient type description.

Syntax

STATIC PROCEDURE BEGINCREATE(
   typecode       IN PLS_INTEGER,
   atype          OUT NOCOPY AnyType);

Parameters

Table 105-2 BEGINCREATE Procedure Parameters
Parameter Description

typecode

Use a constant from DBMS_TYPES package. Typecodes for user-defined type:

can be DBMS_TYPES.TYPECODE_OBJECT

DBMS_TYPES.TYPECODE_VARRAY or

DBMS_TYPES.TYPECODE_TABLE

Typecodes for builtin types:

DBMS_TYPES.TYPECODE_NUMBER etc.

atype

AnyType for a transient type

SETINFO Member Procedure

This procedure sets any additional information required for constructing a COLLECTION or builtin type.

Syntax

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);

Parameters

Table 105-3 SETINFO Procedure Parameters
Parameter Description

self

The transient ANYTYPE that is being constructed.

prec, scale (OPTIONAL)

Required if typecode represents a NUMBER.

Give precision and scale. Ignored otherwise.

len (OPTIONAL)

Required if typecode represents a RAW, CHAR, VARCHAR, or VARCHAR2 type. Gives length.

csid, csfrm (OPTIONAL)

Required if typecode represents types requiring character information such as CHAR, VARCHAR, VARCHAR2, or CFILE.

atype (OPTIONAL)

Required if collection element typecode is a user-defined type such as TYPECODE_OBJECT, etc. It is also required for a built-in type that needs user-defined type information such as TYPECODE_REF. This parameter is not needed otherwise.

The Following Parameters Are Required For Collection Types:

elem_tc

Must be of the collection element's typecode (from DBMS_TYPES package).

elem_count

Pass 0 for elem_count if the self represents a nested table (TYPECODE_TABLE). Otherwise pass the collection count if self represents a VARRAY.

Exceptions

Usage Notes

It is an error to call this function on an AnyType that represents a persistent user defined type.

ADDATTR Member Procedure

This procedure adds an attribute to an AnyType (of typecode DBMS_TYPES.TYPECODE_OBJECT).

Syntax

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);

Parameters

Table 105-4 ADDATTR Procedure Parameters
Parameter Description

self

The transient AnyType that is being constructed. Must be of type DBMS_TYPES.TYPECODE_OBJECT.

aname (OPTIONAL)

Attribute's name. Could be NULL.

typecode

Attribute's typecode. Can be built-in or user-defined typecode (from DBMS_TYPES package).

prec, scale (OPTIONAL)

Required if typecode represents a NUMBER. Give precision and scale. Ignored otherwise.

len (OPTIONAL)

Required if typecode represents a RAW, CHAR, VARCHAR, or VARCHAR2 type. Give length.

csid, csfrm (OPTIONAL)

Required if typecode represents a type requiring character information, such as CHAR, VARCHAR, VARCHAR2, CFILE.

attr_type (OPTIONAL)

AnyType corresponding to a user-defined type. This parameter is required if the attribute is a user defined type.

Exceptions

ENDCREATE Member Procedure

This procedure ends creation of a transient AnyType. Other creation functions cannot be called after this call.

Syntax

MEMBER PROCEDURE EndCreate(
   self           IN OUT NOCOPY AnyType);

Parameter

Table 105-5 ENDCREATE Procedure Parameter
Parameter Description

self

The transient AnyType that is being constructed.

GETPERSISTENT Static Function

This procedure returns an AnyType corresponding to a persistent type created earlier using the CREATE TYPE SQL statement.

Syntax

STATIC FUNCTION GetPersistent(
   schema_name      IN VARCHAR2,
   type_name        IN VARCHAR2, 
   version          IN VARCHAR2 DEFAULT NULL)
   RETURN           AnyType;

Parameters

Table 105-6 GETPERSISTENT Function Parameters
Parameter Description

schema_name

Schema name of the type.

type_name

Type name.

version

Type version.

Returns

An AnyType corresponding to a persistent type created earlier using the CREATE TYPE SQL statement.

GETINFO Member Function

This function gets the type information for the AnyType.

Syntax

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;

Parameters

Table 105-7 GETINFO Function Parameters
Parameter Description

self

The AnyType.

prec, scale

If typecode represents a number. Gives precision and scale. Ignored otherwise.

len

If typecode represents a RAW, CHAR, VARCHAR, or VARCHAR2 type. Gives length.

csid, csfrm

If typecode represents a type requiring character information such as: CHAR, VARCHAR, VARCHAR2, CFILE.

schema_name, type_name, version

Type's schema (if persistent), typename and version.

count

If self is a VARRAY, this gives the VARRAY count. If self is of TYPECODE_OBJECT, this gives the number of attributes.

Returns

The typecode of self.

Exceptions

GETATTRELEMINFO Member Function

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.

Syntax

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;

Parameters

Table 105-8 GETATTRELEMINFO Function Parameters
Parameter Description

self

The AnyType.

pos

If self is of TYPECODE_OBJECT, this gives the attribute position (starting at 1). It is ignored otherwise.

prec, scale

If attribute/collection element typecode represents a NUMBER. Gives precision and scale. Ignored otherwise.

len

If typecode represents a RAW, CHAR, VARCHAR, or VARCHAR2 type. Gives length.

csid, csfrm

If typecode represents a type requiring character information such as: CHAR, VARCHAR, VARCHAR2, CFILE. Gives character set ID, character set form.

attr_elt_type

IF attribute/collection element typecode represents a user-defined type, this returns the AnyType corresponding to it. User can subsequently describe the attr_elt_type.

aname

Attribute name (if it is an attribute of an object type, NULL otherwise).

Returns

The typecode of the attribute or collection element.

Exceptions


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2000, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback