Contents Index Altering procedures Copying procedures in Sybase Central

ASA SQL User's Guide
  Using Procedures, Triggers, and Batches
    Introduction to procedures

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 new_dept procedure to insert an Eastern Sales department:

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

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

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

For more information about EXECUTE permissions, see EXECUTE statement [ESQL].

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.quantity_ordered AS q
FROM sp_customer_products( 149 ) t

For more information, see FROM clause.


Contents Index Altering procedures Copying procedures in Sybase Central