ALLBASE/SQL Reference Manual (36216-90216)

148 Chapter4
Constraints, Procedures, and Rules
Using Procedures
application, and if a transaction is not already in progress, a transaction is begun. If a
transaction is already in progress at the time EXECUTE PROCEDURE is issued, and the
procedure issues either a COMMIT or a ROLLBACK statement to end the transaction, the
entire transaction, including the portion in the application, is affected.
In all cases, it is important to document procedures carefully. Refer to the section
“Recommended Coding Practices for Procedures” later in this chapter.
When a procedure is executed from within a rule, all the transaction management
statements are disallowed and result in an error.
Using SQL Statements in Procedures
Within a procedure, you can use most of the SQL statements that are allowed in embedded
SQL application programs, including COMMIT WORK, ROLLBACK WORK, and ROLLBACK WORK
TO SAVEPOINT. The following (including dynamic SQL statements) are
not
allowed in
procedures:
ADVANCE
BEGIN DECLARE SECTION
BULK statements
CLOSE USING
COMMIT WORK RELEASE
CONNECT
CREATE PROCEDURE (including inside CREATE SCHEMA)
DECLARE CURSOR for EXECUTE PROCEDURE
DESCRIBE
DISCONNECT
END DECLARE SECTION
EXECUTE
EXECUTE IMMEDIATE
EXECUTE PROCEDURE
GENPLAN
INCLUDE
OPEN USING
PREPARE
RELEASE
ROLLBACK WORK RELEASE
SET CONNECTION
SET DML ATOMICITY
SET MULTITRANSACTION
SET SESSION
SET TRANSACTION
SQLEXPLAIN
START DBE
STOP DBE