Creating Procedures - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Creating procedures

Control who has permission to use procedures
This section discusses each of these aspects of using procedures, and also
describes some of the different uses of procedures.
Procedures are created using the
have RESOURCE authority in order to create a procedure.
Where you enter the statement depends on the tool you are using:
You can create the example procedure
sample database from DBISQL as user ID DBA, using password SQL, and
typing the statement in the command window.
You can create the example procedure by connecting to the sample
database from Sybase Central, opening the Procedures folder, and clicking
Add Procedure/Function Wizard. The Wizard walks you through the
process. Alternatively, click Add Procedure/Function Template, which
places you immediately in the last window of the Wizard, the Procedure
window, in which you enter the code for the procedure.
If you are using a tool other than DBISQL or Sybase Central, follow the
instructions for your tool. You may need to change the command delimiter
away from the semicolon before entering the
statement.
The following simple example creates a procedure that carries out an INSERT
into the department table of the sample database, creating a new department.
CREATE PROCEDURE new_dept ( IN id INT,
IN name CHAR(35),
IN head_id INT )
BEGIN
INSERT
INTO DBA.department ( dept_id,
dept_name,
dept_head_id )
VALUES ( id, name, head_id );
END
For a complete description of the
Server IQ Reference Manual.
CHAPTER 6
Using Procedures and Batches
CREATE PROCEDURE
by connecting to the
new_dept
CREATE PROCEDURE
CREATE PROCEDURE
statement. You must
syntax, see Adaptive
231

Advertisement

Table of Contents
loading

Table of Contents