_is_first_date.sql 338 B

123456789101112131415161718
  1. drop function if exists _is_first_date;
  2. DELIMITER //
  3. create function _is_first_date ( _date varchar(8) )
  4. returns boolean
  5. begin
  6. declare ret boolean;
  7. if substring(_date, 7,2) = '01' then
  8. set ret = true;
  9. else
  10. set ret = false;
  11. end if;
  12. return ret;
  13. end; //
  14. DELIMITER ;
  15. select _is_first_date('20220101')