Icon ABORT

Sets the aborted flag for the current execution.

Syntax
ABORT

Usage
Use this statement to set the aborted flag for the current execution. This statement can be used in conjunction with the ABORTED function to perform conditional execution.

Starting in 2.05, you can use the ABORT statement to abort an INSERT, UPDATE, DELETE, or LOAD UPDATE operation from within a trigger. Please see the CREATE TRIGGER topic for more information.

Examples
-- This procedure uses an ABORT statement
-- to exit the WHILE loop once the number of
-- rows visited reaches 10

CREATE PROCEDURE UpdateState()
BEGIN
   DECLARE CustCursor CURSOR WITH RETURN FOR Stmt;
   DECLARE State CHAR(2) DEFAULT '';
   DECLARE TotalRows INTEGER DEFAULT 0;
   DECLARE NumRows INTEGER DEFAULT 0;

   PREPARE Stmt FROM 'SELECT * FROM Customer';

   OPEN CustCursor;
   SET TotalRows=ROWCOUNT(CustCursor);

   START TRANSACTION ON TABLES 'Customer';
   BEGIN

      FETCH FIRST FROM CustCursor ('State') INTO State;

      WHILE (NOT (EOF(CustCursor) OR ABORTED)) DO
         IF (State='FL') THEN
            UPDATE CustCursor SET 'State'='NY';
         END IF;
         FETCH NEXT FROM CustCursor ('State') INTO State;
         SET NumRows=NumRows+1;
         SET PROGRESS TO TRUNC(((NumRows/TotalRows)*100));
         IF (NumRows=10) THEN
            ABORT;
         END WHILE;

      IF (NOT ABORTED) THEN
         COMMIT;
      ELSE
         ROLLBACK;
      END IF;

   EXCEPTION
      ROLLBACK;
   END;
END

SQL 2003 Standard Deviations
This statement deviates from the SQL 2003 standard in the following ways:

DeviationDetails
ExtensionThis SQL statement is an ElevateDB extension.
Image