Advertisement
sathyashrayan

example 1

Jan 30th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.31 KB | None | 0 0
  1. CREATE PROCEDURE customer_sales
  2.         (in_customer_id INT)
  3.    READS SQL DATA
  4. BEGIN
  5.     DECLARE total_sales NUMERIC(8,2);
  6.  
  7.     SELECT SUM(sale_value)
  8.       INTO total_sales
  9.       FROM sales
  10.      WHERE customer_id=in_customer_id;
  11.  
  12.     SELECT CONCAT('Total sales for ',in_customer_id,' is ',total_sales);
  13. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement