Sybase Adaptive Server Anywhere Reference page 612

Table of Contents

Advertisement

RETURN statement
594
The following procedure uses the RETURN statement to avoid
executing a complex query if it is meaningless:
CREATE PROCEDURE customer_products
( in customer_id integer DEFAULT NULL)
RESULT ( id integer, quantity_ordered integer )
BEGIN
IF customer_id NOT IN (SELECT id FROM customer)
OR customer_id IS NULL THEN
RETURN
ELSE
SELECT product.id,sum(
sales_order_items.quantity )
FROM
WHERE sales_order.cust_id=customer_id
AND sales_order.id=sales_order_items.id
AND sales_order_items.prod_id=product.id
GROUP BY product.id
END IF
END
product,
sales_order_items,
sales_order

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?

Questions and answers

Table of Contents