Skip Headers

Oracle Call Interface Programmer's Guide
Release 2 (9.2)

Part Number A96584-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

OCI Any Type and Data Functions, 9 of 26


OCIAnyDataAttrSet()

Purpose

Sets the attribute at the current position with a given value.

Syntax

sword OCIAnyDataAttrSet ( OCISvcCtx    *svchp, 
                          OCIError     *errhp, 
                          OCIAnyData   *sdata, 
                          OCITypeCode  tc, 
                          OCIType      *attr_type, 
                          dvoid        *null_ind, 
                          dvoid        *attr_value, 
                          ub4          length, 
                          boolean      is_any );

Parameters

svchp (IN)

The OCI service context.

errhp (IN/OUT)

The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().

sdata (IN/OUT)

Initialized OCIAnyData.

tc (IN)

Typecode of the attribute. Type checking happens based on tc, attr_type and the type information in the OCIAnyData.

attr_type (IN)

OPTIONAL

attr_type will give the type description of the referenced type (for OCI_TYPECODE_REF) and it will give the type description of the collection type (for OCI_TYPECODE_VARRAY, OCI_TYPECODE_TABLE) and it will give the type description of the object (for OCI_TYPECODE_OBJECT). This parameter is not required for built-in typecodes or if OCI_TYPECODE_NONE is specified.

null_ind (IN)

Indicates if the attr_value is NULL. Pass (OCIInd *) for all typecodes except OCI_TYPECODE_OBJECT. The indicator should be OCI_IND_NOTNULL if the value is not NULL and it should be OCI_IND_NULL for a NULL value.

If the typecode is OCI_TYPECODE_OBJECT, pass a pointer to the indicator struct of the attr_value as the argument here.

attr_value (IN)

Value for the attribute

length (IN)

Currently, this parameter is ignored. Pass 0 here. In the future, this may be used for certain typecodes where the data representation itself will not give the length implicitly.

is_any (IN)

Is attribute in the form of OCIAnyData?

Comments

OCIAnyDataBeginCreate() creates an OCIAnyData with an empty skeleton instance. To fill the attribute values, use OCIAnyDataAttrSet() (for OCI_TYPECODE_OBJECT) or OCIAnyDataCollAttrAddElem() (for the collection typecodes).

Attribute values must be set in order, from the first attribute to the last. The current attribute number is remembered as state maintained inside the OCIAnyData. Piece-wise construction of embedded attributes and collection elements are not yet supported.

This call sets the attribute at the current position with attr_value. Once piece-wise construction has started for an OCIAnyData instance, the OCIAnyDataConstruct() calls can no longer be used.

tc must match the type of the attribute at the current position. Otherwise, an error is returned.

If is_any is TRUE, then the attribute must be in the form of OCIAnyData* and it is copied into the enclosing OCIAnyData (data) without any conversion.

Here is the list of available datatypes which can be used as object attribute types and the corresponding types of the attribute value that should be passed:

Datatypes attr_value

VARCHAR2, VARCHAR, CHAR

OCIString *

NUMBER, REAL, INT, FLOAT, DECIMAL

OCINumber *

DATE

OCIDate *

TIMESTAMP

OCIDateTime *

TIMESTAMP WITH TIME ZONE

OCIDateTime *

TIMESTAMP WITH LOCAL TIME ZONE

OCIDateTime *

INTERVAL YEAR TO MONTH

OCIInterval *

INTERVAL DAY TO SECOND

OCIInterval *

BLOB

OCILobLocator * or OCIBlobLocator *

CLOB

OCILobLocator * or OCIClobLocator *

BFILE

OCILobLocator *

REF

OCIRef *

RAW

OCIRaw *

VARRAY

OCIArray * (or OCIAnyData * if is_any is TRUE)

TABLE

OCITable * (or OCIAnyData * if is_any is TRUE)

OBJECT

dvoid * (or OCIAnyData * if is_any is TRUE)


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996, 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