Skip to content

Instantly share code, notes, and snippets.

@leonguyen
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save leonguyen/9718417 to your computer and use it in GitHub Desktop.

Select an option

Save leonguyen/9718417 to your computer and use it in GitHub Desktop.
SP Parameter
DELIMITER $$
CREATE PROCEDURE CountOrderByStatus(
IN orderStatus VARCHAR(25),
OUT total INT)
BEGIN
SELECT count(orderNumber)
INTO total
FROM orders
WHERE status = orderStatus;
END;
CALL CountOrderByStatus('in process',@total);
SELECT @total AS total_in_process;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment