CHAPTER 6 Using Procedures and Batches
231
•
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.
Creating procedures
Procedures are created using the
CREATE PROCEDURE
statement. You must
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
new_dept
by connecting to the
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
CREATE PROCEDURE
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
CREATE PROCEDURE
syntax, see Adaptive
Server IQ Reference Manual.
Summary of Contents for Adaptive Server IQ 12.4.2
Page 1: ...Administration and Performance Guide Adaptive Server IQ 12 4 2 ...
Page 16: ...xvi ...
Page 20: ...Related documents xx ...
Page 40: ...Compatibility with earlier versions 20 ...
Page 118: ...Troubleshooting startup shutdown and connections 98 ...
Page 248: ...Importing data by replication 228 ...
Page 306: ...Integrity rules in the system tables 286 ...
Page 334: ...Cursors in transactions 314 ...
Page 396: ...Users and permissions in the system tables 376 ...
Page 438: ...Determining your data backup and recovery strategy 418 ...
Page 484: ...Network performance 464 ...
Page 500: ...System utilities to monitor CPU use 480 ...
Page 514: ...Characteristics of Open Client and jConnect connections 494 ...
Page 536: ...Index 516 ...