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

ANYDATA TYPE, 2 of 2


Summary of ANYDATA Subprograms

Table 103-1 ANYDATA Subprograms
Subprogram Description

BEGINCREATE Static Procedure

Begins creation process on a new AnyData.

PIECEWISE Member Procedure

Sets the MODE of access of the current data value to be an attribute at a time (if the data value is of TYPECODE_OBJECT).

SET Member Procedures

Sets the current data value.

ENDCREATE Member Procedure

Ends creation of an AnyData.

GETTYPENAME Member Function

Get the fully qualified type name for the AnyData.

GETTYPE Member Function

Gets the Type of the AnyData.

GET Member Functions

Gets the current data value (which should be of appropriate type).

BEGINCREATE Static Procedure

This procedure begins the creation process on a new AnyData.

Syntax

STATIC PROCEDURE BeginCreate(
   dtype          IN OUT NOCOPY AnyType,
   adata          OUT NOCOPY AnyData);

Parameters

Table 103-2 BEGINCREATE Procedure Parameters
Parameter Description

dtype

The type of the AnyData. (Should correspond to OCI_TYPECODE_OBJECT or a Collection typecode.)

adata

AnyData being constructed.

Exception

DBMS_TYPES.invalid_parameters: dtype is invalid (not fully constructed, etc.)

Usage Notes

There is no need to call PieceWise() immediately after this call. The construction process begins in a piece-wise manner automatically.

PIECEWISE Member Procedure

This procedure sets the MODE of access of the current data value to be an attribute at a time (if the data value is of TYPECODE_OBJECT).

It sets the MODE of access of the data value to be a collection element at a time (if the data value is of collection type). Once this call has been made, subsequent calls to Set*() and Get*() will sequentially obtain individual attributes or collection elements.

Syntax

MEMBER PROCEDURE PieceWise(
   self         IN OUT NOCOPY AnyData);

Parameters

Table 103-3 BEGINCREATE Procedure Parameters
Parameter Description

self

The current data value.

Exceptions

Usage Notes

The current data value must be of an OBJECT or COLLECTION type before this call can be made.

Piece-wise construction and access of nested attributes that are of object or collection types is not supported.

SET Member Procedures

Sets the current data value.

This is a list of procedures that should be called depending on the type of the current data value. The type of the data value should be the type of the attribute at the current position during the piece-wise construction process.

Syntax

MEMBER PROCEDURE SetNumber(
   self        IN OUT NOCOPY AnyData, 
   num         IN NUMBER,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetDate(
   self        IN OUT NOCOPY AnyData, 
   dat         IN DATE,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetChar(
   self        IN OUT NOCOPY AnyData, 
   c           IN CHAR,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetVarchar(
   self        IN OUT NOCOPY AnyData, 
   c           IN VARCHAR,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetVarchar2(
   self        IN OUT NOCOPY AnyData,
   c           IN VARCHAR2, 
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetRaw(
   self        IN OUT NOCOPY AnyData, 
   r           IN RAW,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetBlob(
   self        IN OUT NOCOPY AnyData, 
   b           IN BLOB,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetClob(
   self        IN OUT NOCOPY AnyData,
   c           IN CLOB,
   last_elem   IN boolean DEFAULT FALSE)'
MEMBER PROCEDURE SetBfile(
   self        IN OUT NOCOPY AnyData,
   b           IN BFILE,
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetObject(
   self        IN OUT NOCOPY AnyData,
   obj         IN "<object_type>",
   last_elem   IN boolean DEFAULT FALSE);
MEMBER PROCEDURE SetRef(
   self        IN OUT NOCOPY AnyData,
   rf          IN REF "<object_type>",
   last_elem   IN boolean DEFAULT FALSE),
MEMBER PROCEDURE SetCollection(
   self        IN OUT NOCOPY AnyData,
   col         IN "<collectyion_type>",
   last_elem   IN boolean DEFAULT FALSE);

Parameters

Table 103-4 SET*() Procedure Parameters
Parameter Description

self

An AnyData.

num

The number, etc., that is to be set.

last_elem

Relevant only if AnyData represents a collection.

Set to TRUE if it is the last element of the collection, FALSE otherwise.

Exceptions

Usage Notes

When BeginCreate() is called, construction has already begun in a piece-wise fashion. Subsequent calls to Set*() will set the successive attribute values.

If the AnyData is a standalone collection, the Set*() call will set the successive collection elements.

ENDCREATE Member Procedure

This procedure ends creation of an AnyData. Other creation functions cannot be called after this call.

Syntax

MEMBER PROCEDURE EndCreate(
   self         IN OUT NOCOPY AnyData);

Parameters

Table 103-5 ENDCREATE Procedure Parameter
Parameter Description

self

An AnyData.

GETTYPENAME Member Function

This function gets the fully qualified type name for the AnyData.

If the AnyData is based on a built-in type, this function will return NUMBER etc.

If it is based on a user defined type, this function will return <schema_name>.<type_name>. for example, SCOTT.FOO.

If it is based on a transient anonymous type, this function will return NULL.

Syntax

MEMBER FUNCTION GetTypeName(
   self         IN AnyData)
   RETURN       VARCHAR2;

Parameters

Table 103-6 GETTYPENAME Function Parameter
Parameter Description

self

An AnyData.

Returns

Type name of the AnyData.

GETTYPE Member Function

This function gets the typecode of the AnyData.

Syntax

MEMBER FUNCTION GetType(
   self          IN AnyData,
   typ           OUT NOCOPY AnyType)
   RETURN        PLS_INTEGER;

Parameters

Table 103-7 GETTYPE Function Parameter
Parameter Description

self

An AnyData.

typ

The AnyType corresponding to the AnyData. May be NULL if it does not represent a user-defined type.

Returns

The typecode corresponding to the type of the AnyData.

GET Member Functions

These functions get the current data value (which should be of appropriate type).

The type of the current data value depends on the MODE with which we are accessing (depending on whether we have invoked the PieceWise() call).

If PieceWise() has NOT been called, we are accessing the AnyData in its entirety and the type of the data value should match the type of the AnyData.

If PieceWise() has been called, we are accessing the AnyData piece-wise. The type of the data value should match the type of the attribute (or collection element) at the current position.

Syntax

MEMBER FUNCTION GetNumber(
   self         IN AnyData,
   num          OUT NOCOPY NUMBER)
   RETURN       PLS_INTEGER;
  MEMBER FUNCTION GetDate(
   self         IN AnyData,
   dat          OUT NOCOPY DATE)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetChar(
   self         IN AnyData,
   c            OUT NOCOPY CHAR)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetVarchar(
   self         IN AnyData,
   c            OUT NOCOPY VARCHAR)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetVarchar2(
   self         IN AnyData,
   c            OUT NOCOPY VARCHAR2)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetRaw(
   self         IN AnyData,
   r            OUT NOCOPY RAW)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetBlob(
   self         IN AnyData,
   b            OUT NOCOPY BLOB)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetClob(
   self         IN AnyData,
   c            OUT NOCOPY CLOB)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetBfile(
   self         IN AnyData,
   b            OUT NOCOPY BFILE)
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetObject(
   self         IN AnyData,
   obj          OUT NOCOPY "<object_type>")
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetRef(
   self         IN AnyData,
   rf           OUT NOCOPY REF "<object_type>")
   RETURN       PLS_INTEGER;
MEMBER FUNCTION GetCollection(
   self         IN AnyData,
   col          OUT NOCOPY "<collection_type>")
   RETURN       PLS_INTEGER;

Parameters

Table 103-8 GET* Function Parameter
Parameter Description

self

An AnyData.

num

The number, etc., to be obtained.

Returns

DBMS_TYPES.SUCCESS or DBMS_TYPES.NO_DATA

The return value is relevant only if PieceWise() has been already called (for a collection). In such a case, DBMS_TYPES.NO_DATA signifies the end of the collection when all elements have been accessed.

Exceptions

DBMS_TYPES.type_mismatch: When the expected type is different from the passed in type.

DBMS_TYPES.invalid_parameters: Invalid Parameters (if it is not appropriate to add a number at this point in the creation process).

DBMS_TYPES.incorrect_usage: Incorrect usage.


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