Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created October 19, 2013 12:12
Show Gist options
  • Save anytizer/7055212 to your computer and use it in GitHub Desktop.
Save anytizer/7055212 to your computer and use it in GitHub Desktop.
Simple mysql function in 3 steps
DROP FUNCTION IF EXISTS f_currency;
DELIMITER $$
CREATE FUNCTION f_currency()
RETURNS FLOAT(8,2)
BEGIN
RETURN ROUND(RAND()*100, 2);
END $$
SELECT f_currency();
SELECT ROUND(RAND()*100, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment