Define a local alias for a procedure: a means of accessing a procedure on a remote server, through a local resource. Before you can map procedures from another server to the local alias, you must define the remote server where the procedure is located.
| Database Version | Procedure Privileges |
|---|---|
| SAP Sybase IQ 15.3 and 15.4 | Remote procedure to be owned by self or any user –
|
| SAP Sybase IQ 16.0 | Remote procedure to be owned by self –
Remote procedure to be owned by any user –
|
Use a case statement to classify the results of a query:
CREATE PROCEDURE ProductType (IN product_id INT, OUT type CHAR(10))
BEGIN
DECLARE prod_name CHAR(20) ;
SELECT name INTO prod_name FROM "GROUPO"."Products"
WHERE ID = product_id;
CASE prod_name
WHEN 'Tee Shirt' THEN
SET type = 'Shirt'
WHEN 'Sweatshirt' THEN
SET type = 'Shirt'
WHEN 'Baseball Cap' THEN
SET type = 'Hat'
WHEN 'Visor' THEN
SET type = 'Hat'
WHEN 'Shorts' THEN
SET type = 'Shorts'
ELSE
SET type = 'UNKNOWN'
END CASE ;
END