Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Applies To
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();
}