CREATE PROCEDURE statement [T-SQL]

Description

Creates a new procedure in the database in a manner compatible with Adaptive Server Enterprise.

Syntax

The following subset of the Transact-SQL CREATE PROCEDURE statement is supported in Sybase IQ.
CREATE PROCEDURE [owner.]procedure_name
... [ [ ( ] @parameter_name data-type [ = default ] [ OUTPUT ] [, ..] [ ) ] ]
...[ WITH RECOMPILE ]
...AS
...statement-list

Usage

The following differences between Transact-SQL and Sybase IQ statements are listed to help those writing in both dialects.

CREATE PROCEDURE showdept @deptname varchar(30)
AS
	SELECT employee.emp_lname, employee.emp_fname
	FROM department, employee
	WHERE department.dept_name = @deptname
	AND department.dept_id = employee.dept_id

The following is the corresponding Sybase IQ procedure:

CREATE PROCEDURE showdept(in deptname 
			varchar(30) )
RESULT ( lastname char(20), firstname char(20))
ON EXCEPTION RESUME
BEGIN
	SELECT employee.emp_lname, employee.emp_fname
	FROM department, employee
	WHERE department.dept_name = deptname
	AND department.dept_id = employee.dept_id
END

Side effects

Automatic commit.

Standards

Permissions

Must have RESOURCE authority.

See also

CREATE PROCEDURE statement