Created
April 8, 2020 17:07
-
-
Save vjaro/50a6c7e84ef38a45f525e1aaf9de1216 to your computer and use it in GitHub Desktop.
How to create MySQL Stored Functions using PDO in SugarCRM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS getAge; | |
CREATE FUNCTION getAge(date_of_birth DATE) RETURNS INT | |
BEGIN | |
DECLARE age INT DEFAULT 0; | |
SELECT TIMESTAMPDIFF(YEAR,date_of_birth,CURDATE()) INTO age; | |
RETURN age; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment