Sybase 12.4.2 manual Structure of procedures, SQL statements allowed in procedures, 243

Models: 12.4.2

1 536
Download 536 pages 20.34 Kb
Page 263
Image 263

CHAPTER 6 Using Procedures and Batches

The structure of procedures

The body of a procedure consists of a compound statement as discussed in “Using compound statements” on page 240. A compound statement consists of a BEGIN and an END, enclosing a set of SQL statements. The statements must be separated by semicolons.

The SQL statements that can occur in procedures are described in “SQL statements allowed in procedures” on page 243.

Procedures can contain control statements, which are described in “Control statements” on page 239.

SQL statements allowed in procedures

Almost all SQL statements are allowed within procedures, including the following:

SELECT, UPDATE, DELETE, INSERT and SET VARIABLE.

The CALL statement to execute other procedures.

Control statements (see “SQL statements allowed in procedures” on page 243).

Cursor statements (see “Using cursors in procedures” on page 251).

Exception handling statements (see “Using exception handlers in procedures” on page 261).

The EXECUTE IMMEDIATE statement.

Some SQL statements are not allowed within procedures. These include the following:

CONNECT statement

DISCONNECT statement.

COMMIT, ROLLBACK and SAVEPOINT statements are allowed within procedures with certain restrictions (see “Transactions and savepoints in procedures”).

For details, see the Usage for each SQL statement in the chapter “SQL

Statements” in Adaptive Server IQ Reference Manual.

243

Page 263
Image 263
Sybase 12.4.2 manual Structure of procedures, SQL statements allowed in procedures, 243