Created
March 20, 2015 14:55
-
-
Save nawawi/19bba9230fcf7e9da96c to your computer and use it in GitHub Desktop.
contoh duit masuk dan keluar
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
-- function duit masuk simpan dalam sen | |
-- contoh guna: INSERT INTO `test` (`duit`) VALUES ( duitmasuk('1.20') ); | |
CREATE FUNCTION `duitmasuk`(`num` FLOAT) RETURNS int(11) | |
DETERMINISTIC | |
RETURN ( num * 100 ) | |
-- function duit keluar dalam ringgit | |
-- conth guna: SELECT duitkeluar(duit) as duit FROM `test` | |
CREATE FUNCTION `duitkeluar`(num INT) RETURNS float | |
DETERMINISTIC | |
RETURN ( num / 100 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment