Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

BEGIN statement [TSQL]

Specifies a compound statement.

Syntax
BEGIN
statement-list
END
statement-list : 
sql-statement
| variable-declaration
| cursor-declaration
| temporary-table-declaration
variable-declaration : see the DECLARE statement
cursor-declaration : see the DECLARE CURSOR statement
temporary-table-declaration : see the DECLARE LOCAL TEMPORARY TABLE statement
Parameters
  • statement-list

    A list of statements and declarations.

Remarks

A BEGIN statement allows one or more SQL statements to be grouped together and treated as a unit, and starts with the keyword BEGIN and ends with the keyword END.

Error handling is different for Transact-SQL compound statements.

Privileges

None.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    BEGIN, which identifies a compound statement, comprises part of optional ANSI/ISO SQL Language Feature P002.

Example

The example below declares the following variables:

  • v1 as an INT with the initial setting of 5.
  • v2 and v3 as CHAR(10), both with an initial value of abc.
BEGIN
   DECLARE v1 INT = 5
   DECLARE v2, v3 CHAR(10) = 'abc'
			// ...
END