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

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Using Procedures, Triggers, and Batches » Introduction to procedures

Altering procedures Next Page

Calling procedures

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

For more information, see CALL statement.

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

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

After this call, you may want to check the Departments table to see that the new department has been added.

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

For more information about EXECUTE permissions, see GRANT statement.

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

SELECT t.ID, t.QuantityOrdered AS q
FROM ShowCustomerProducts( 149 ) t;

For more information, see FROM clause.