EXIT

Top  Previous  Next

Terminates current script block or subroutine execution.

 

Syntax

  EXIT;

 

The EXIT statement causes execution of the current script block or subroutine to jump to the final END statement returning to the caller. Calling EXIT in a function subroutine will return NULL.

 

Example

In the example below, the MAX_ITERATIONS input parameter is used to test for the exit condition. If reached, the routine exits.

 

EXECUTE UDSBLOCK (MAX_ITERATIONS INTEGER)

  RETURNS (I INTEGER)

AS

BEGIN

  I = 1;

  WHILE (1=1) /* endless loop */

  DO

  BEGIN

    IF (I = MAX_ITERATIONS) /* exit condition */

 THEN EXIT; /* terminate */

    I = I + 1;

  END

END