Monday 3 September 2018

The MySQL stored procedure does not work

Can someone help me with why this statement returns NULL ?

DROP PROCEDURE IF EXISTS hr.Test;
CREATE PROCEDURE hr.`Test`
           (
             IN `empID` BIGINT(20)
           , IN untill date
           , IN `salaryType` INT(10)
           )
    MODIFIES SQL DATA
BEGIN
  select untill;
END;

call Test(2, '2014-01', 2);

It's strange since when i want to return value of empID or salaryType it works!!! Any idea ?
Thanks,

Simple reason because '2014-01' is an invalid date and so it returns null. To prove that try the below query and it will return null
select cast('2014-01' as date)

0 comments:

Post a Comment