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

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Stored procedures, triggers, batches, and user-defined functions » Procedures

 

Calling a procedure (SQL)

CALL statements invoke procedures. Procedures can be called by an application program or by other procedures and triggers.

Prerequisites

You must be the owner of the procedure, have the EXECUTE privilege on the procedure, or have the EXECUTE ANY PROCEDURE system privilege.

All users who have been granted EXECUTE privilege for the procedure can call the procedure, even if they have no privilege on the table.

 Task
  • Execute the following statement to call a procedure and insert values:

    CALL procedure-name( values );

    After this call, you may want to ensure that the values have been added.

    Note

    You can call a procedure that returns a result set by calling it in a query. You can execute queries on the result sets of procedures and apply WHERE clauses and other SELECT features to limit the result set.

Results

The procedure is called and executed.

Example

The following statement calls the NewDepartment procedure to insert an Eastern Sales department:

CALL NewDepartment( 210, 'Eastern Sales', 902 );

After this call completes, you can to check the Departments table to verify that the new department has been added.

All users who have been granted EXECUTE privilege for the procedure can call the NewDepartment procedure, even if they have no privilege on the Departments table.


 See also