Status property: SQL class

Description

This property returns the status of the last statement executed. You can use either the constant or the numeric value for this property. The values for this property are:

Numeric Value Constant Value Description

0

%SQLStatus_OK

No Errors.

1

%SQLStatus_NotFound

Record not found.

2

%SQLStatus_Duplicate

Duplicate Record Found

This property is read-only.

Example

The following example determines what went wrong after an update:

Local SQL &SQL;
Local Record &NEWREC, &OLDREC;

/* Create and initialize &OLDREC with the keys of the 
record to be updated.  Create and initialize &NEWREC 
with the new field values for the record.  */
...;

/* Create and execute the update.  */
&SQL = CreateSQL("%Update(:1, :2)", &NEWREC, &OLDREC);
Evaluate &SQL.Status
When = %SQLStatus_OK
   /* It worked.  */
When = %SQLStatus_NotFound
   /* The OLDREC keys were not found.  */
When = %SQLStatus_Duplicate
   /* The NEWREC keys were already there.  */
End-Evaluate;