Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 SQL Manual » SQL/PSM Statements » ABORT |
ABORT
-- 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
Deviation | Details |
Extension | This SQL statement is an ElevateDB extension. |
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |