Processing return status results

A return status result set is generated by the execution of a stored procedure. All stored procedures return a status number. See the description of the return command in the Adaptive Server Enterprise Reference Manual.

A return status result set consists of a single row containing a return status.

An application calls ct_bind and ct_fetch to process a return status.

Most synchronous applications use a program structure similar to the following one to process a return status result set:

 case CS_STATUS_RESULT
     ct_bind to bind the status to a program variable
     while ct_fetch returns CS_SUCCEED or CS_ROW_FAIL
         if CS_SUCCEED
             process the return status
         else if CS_ROW_FAIL
             handle the failure
         end if
     end while
     switch on ct_fetch’s final return code
         case CS_END_DATA...
         case CS_CANCELED...
         case CS_FAIL...
     end switch
 end case