Archive for December 2017

Create MySQL function

In MySQL, function is different than procedure by returning the value and can be called within SELECT statement. DETERMINISTIC means that the function always produces same results for the same input parameters. CREATE FUNCTION `Sample`(parameter VARCHAR(10)) RETURNS TINYINT(3) UNSIGNED DETERMINISTIC BEGIN DECLARE myfunctionID TINYINT UNSIGNED;   IF parameter = ‘sample1’ THEN SET returnID = 1; […]