From 0ba58666a7e5ae2951110403315df38dab2e28c8 Mon Sep 17 00:00:00 2001 From: "asuka.asakura" Date: Mon, 17 Apr 2023 18:26:07 +0900 Subject: [PATCH] =?UTF-8?q?NEWDWH2021-1057=20=E3=82=B9=E3=83=88=E3=82=A2?= =?UTF-8?q?=E3=83=89=E3=83=95=E3=82=A1=E3=83=B3=E3=82=AF=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src05/src05_create_function.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 rds_mysql/stored_procedure/src05/src05_create_function.sql diff --git a/rds_mysql/stored_procedure/src05/src05_create_function.sql b/rds_mysql/stored_procedure/src05/src05_create_function.sql new file mode 100644 index 00000000..e4e8cba3 --- /dev/null +++ b/rds_mysql/stored_procedure/src05/src05_create_function.sql @@ -0,0 +1,19 @@ +-- 処理日取得(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;