Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 1 (10.1)

Part Number B10119-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Clear Method

Applies To

OValue

OParameter

Description

This method clears the value stored in the object, leaving a value of NULL.

Usage

oresult Clear(void)

Remarks

Oracle database columns may have a value of NULL. This database NULL means "no value specified", rather than the NULL pointer of C++. Sometimes it is desirable to generate a NULL value. The Clear method makes the OValue or OParameter object hold a NULL value.

Return Value

An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).

Example

This example gets a value from a dynaset and then sets it to NULL.

// we have a dynaset named empdyn

// get the current commission value

OValue commission;

empdyn.GetFieldValue("comm", &commission);

// if the commission has a value, change it to NULL

if (!commission.IsNull())

{ // make the commission NULL

commission.Clear();

empdyn.StartEdit();

empdyn.SetFieldValue("comm", commission);

empdyn.Update();

}