Allows a table function or a table operator to gracefully stop a request when an error condition prevents continuation.
If this copy of the table function stops the request, FNC_TblAbort returns 1.
If another copy of the table function stops the request, FNC_TblAbort returns 0.
This library function is valid during any phase or mode in which the table function was invoked.
Syntax
int FNC_TblAbort(void)
Usage Notes
Because any copy of the table function can call FNC_TblAbort, the table function must check the return value to determine which copy made the call.
Return Value | Meaning |
---|---|
0 | Another copy of the table function initiated the stop. Upon return of the call to FNC_TblAbort, this copy of the table function returns. This copy of the function is called again, and when the function calls FNC_GetPhase, the FNC_Phase argument is set to TBL_ABORT. The function can close all resources and release any allocated memory. |
1 | This copy of the table function initiated the stop. The other copies of the table function are notified of the stop the next time they call FNC_GetPhase, when the the value of the FNC_Phase return argument is TBL_ABORT. Control returns to this copy of the table function after all other copies return from the TBL_ABORT phase, when the table function takes the following steps:
|
This function can only be called from within a table function or a table operator. Calling this function from a UDM, external stored procedure, scalar function, or aggregate function results in an exception on the transaction.
Example Using FNC_TblAbort
FNC_Phase Phase; if (FNC_GetPhase(&Phase) == TBL_MODE_CONST) { switch(Phase) { ... case TBL_BUILD: { ... /* Get some bad data here. Need to abort. */ if( FNC_TblAbort() ) { /* At this point, all other copies of the function */ /* should have finished cleaning up */ strcpy(sqlstate, "U0004"); strcpy(error_message, "Bad Input data - not processed"); break; } ... } } ...