Previous Topic: RESIGNAL StatementNext Topic: SIGNAL Statement


Example

A RESIGNAL statement example follows. In this example, SQLSTATE 'S0480' remains unhandled and can be seen by the end user. In the example that follows, logic that is not shown (for space considerations) is indicated by three vertically arranged periods.

 .
 .
 .
 declare continue handler for sqlexception
 errHandler1: begin atomic
    set errCount = errCount + 1;
    get STACKED diagnostics
       sqlStateLocal = returned_sqlstate, errMsg = message_text;
    insert into errTable values
       (orderId,errCount,"sqlState",errMsg);
    if sqlStateLocal = 'S0480'
       RESIGNAL
    endif
 end errHandler1;
 .
 .
 .