Syntax rules for stored procedures

Use of parentheses and quotes in stored procedure calls varies, depending on whether you enter the procedure name directly, as you can in Interactive SQL, or invoke it with a CALL statement. Some variations are permitted because the product supports both Sybase IQ SQL and Transact-SQL syntax. If you need Transact-SQL compatibility, be sure to use Transact-SQL syntax.

See Table 7-1 for an explanation of syntax variations.

Table 7-1: Stored procedure syntax variations

Syntax

Syntax type

Explanation

procedure_name ('param')

Sybase IQ

Quotes are required if you enclose parameters in parentheses.

procedure_name 'param'

Sybase IQ

Parentheses are optional if you enclose parameters in quotes.

procedure_name param

Transact-SQL

If you omit quotes around parameters, you must also omit parentheses.

procedure_name

Sybase IQ or Transact-SQL

Use this syntax if you run a procedure with no parameters directly in DBISQL, and the procedure has no parameters.

call procedure_name (param=’value’)

Sybase IQ

Use this syntax to call a procedure that passes a parameter value.

When you use Transact-SQL stored procedures, you must use the Transact-SQL syntax.