newdwh2021/rds_mysql/stored_procedure/src05/src05_create_function.sql

20 lines
424 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 処理日取得date型
delimiter //
CREATE FUNCTION src05.get_syor_date()
RETURNS date DETERMINISTIC
BEGIN
RETURN (SELECT STR_TO_DATE(syor_date,'%Y%m%d') FROM src05.hdke_tbl);
END
//
delimiter;
-- 年月を日付加工date型
delimiter //
CREATE FUNCTION src05.to_date_yyyymm01(yyyymm varchar(6))
RETURNS date DETERMINISTIC
BEGIN
RETURN (STR_TO_DATE(CONCAT(yyyymm,'01'),'%Y%m%d'));
END
//
delimiter;