SET EXCEPTION

SET EXCEPTION

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

SET EXCEPTION

Triggers an exception handler in the absence of an exception condition.

Syntax

SET EXCEPTION condition

Parameters

conditionCan be BREAK Mimics a terminal or process “break” condition (i.e., the user pressing the “break” key). DEADLOCK Mimics a deadlock in a multi-user system. Does not abort the current transaction. ERROR Mimics an error condition. WARNING Mimics a warning condition.

Comments

A SET EXCEPTION command mimics the specified condition, triggering the associated exception handler, if such a handler has been declared (by the ON command). The SET EXCEPTION command cannot be used in the body of an exception handler. The SET EXCEPTION command has no effect on system variables such as $InTransaction, $ErrCode, or $ErrLevel. The SET EXCEPTION command is not affected by the SET RESET and SET RESTORE commands.

Example

localprocedure LocProc (inout $Deadlock)
   on deadlock
      let $Deadlock = $true
      return
   endon
   ... other commands ...
endprocedure
procedure MainProc ()
   on deadlock
      goto RetryTransaction
   endon
   ... other commands ...
RetryTransaction:
   transaction
   ... other commands ...
   LocProc ($Deadlock)
   if $Deadlock = $true
      set exception deadlock
   endif
   ... other commands ...
   endtransaction
endprocedure

In the preceding example, SET EXCEPTION mimics a DEADLOCK condition, triggering the declared deadlock exception handler in one procedure when the deadlock has actually occurred in another procedure.

See Also

ON

Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese