From 473328c639ca722dbb23cb26d17e1fc2e0bf70bf Mon Sep 17 00:00:00 2001 From: yuusuke_kanamura Date: Thu, 11 Jul 2024 14:45:01 +0900 Subject: [PATCH] =?UTF-8?q?feat:SQL=E3=81=AE=E4=BA=88=E7=B4=84=E8=AA=9E?= =?UTF-8?q?=E3=82=92=E5=A4=A7=E6=96=87=E5=AD=97=E3=81=AB=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=80=81JST=E5=A4=89=E6=8F=9B=E3=81=AB=E3=81=A4=E3=81=84?= =?UTF-8?q?=E3=81=A6=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/hcp_web_accsess_log_ex.sql | 14 ++++++++------ .../settings/hcp_web_medpass_user_mst_ex.sql | 18 +++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/s3/data/hcp_web/settings/hcp_web_accsess_log_ex.sql b/s3/data/hcp_web/settings/hcp_web_accsess_log_ex.sql index 454fc632..b09e56ec 100644 --- a/s3/data/hcp_web/settings/hcp_web_accsess_log_ex.sql +++ b/s3/data/hcp_web/settings/hcp_web_accsess_log_ex.sql @@ -1,9 +1,11 @@ -/* date_time(日付型)がnullのレコードを抽出し、date_time(文字型) を日付型に変換してセットする。 */ -update src06.hcp_web_access_log set +/* date_time(日付型)がNULLのレコードを抽出し、date_time(文字型) を日付型に変換してセットする。 */ +/* date_time(文字型) はUTCの日付を取得するため、date_time(日付型)はMeDaCAのポリシーに合わせてJSTに変換する */ +UPDATE src06.hcp_web_access_log SET date_time = STR_TO_DATE(date_time_org, '%Y-%m-%d %H:%i:%s') + INTERVAL 9 HOUR -where date_time_org is not null and date_time is null and ins_date >= (now() - INTERVAL 1 YEAR); +WHERE date_time_org IS NOT NULL and date_time IS NULL and ins_date >= (now() - INTERVAL 1 YEAR); -/* post_evar29(日付型) がnullのレコードを抽出し、post_evar29(文字型)を日付型に変換してセットする。 */ -update src06.hcp_web_access_log set +/* post_evar29(日付型) がNULLのレコードを抽出し、post_evar29(文字型)を日付型に変換してセットする。 */ +/* date_time(文字型) はUTCの日付を取得するため、date_time(日付型)はMeDaCAのポリシーに合わせてJSTに変換する */ +UPDATE src06.hcp_web_access_log SET post_evar29 = STR_TO_DATE(post_evar29_org, '%Y-%m-%dT%H:%i:%s') + INTERVAL 9 HOUR -where post_evar29_org is not null and post_evar29 is null and ins_date >= (now() - INTERVAL 1 YEAR); \ No newline at end of file +WHERE post_evar29_org IS NOT NULL and post_evar29 IS NULL and ins_date >= (now() - INTERVAL 1 YEAR); \ No newline at end of file diff --git a/s3/data/hcp_web/settings/hcp_web_medpass_user_mst_ex.sql b/s3/data/hcp_web/settings/hcp_web_medpass_user_mst_ex.sql index f53d0acd..7042aa2d 100644 --- a/s3/data/hcp_web/settings/hcp_web_medpass_user_mst_ex.sql +++ b/s3/data/hcp_web/settings/hcp_web_medpass_user_mst_ex.sql @@ -1,14 +1,14 @@ -/* 生年月日(日付型)がnullのレコードを抽出し、生年月日(文字型) を日付型に変換してセットする。 */ -update src06.hcp_web_medpass_user_mst set +/* 生年月日(日付型)がNULLのレコードを抽出し、生年月日(文字型) を日付型に変換してセットする。 */ +UPDATE src06.hcp_web_medpass_user_mst SET BirthDate = STR_TO_DATE(BirthDate_org, '%Y-%m-%d') -where BirthDate_org is not null and BirthDate is null; +WHERE BirthDate_org IS NOT NULL and BirthDate IS NULL; -/* 登録日時(日付型) がnullのレコードを抽出し、登録日時(文字型)を日付型に変換してセットする。 */ -update src06.hcp_web_medpass_user_mst set +/* 登録日時(日付型) がNULLのレコードを抽出し、登録日時(文字型)を日付型に変換してセットする。 */ +UPDATE src06.hcp_web_medpass_user_mst SET CreateDate = STR_TO_DATE(CreateDate_org, '%Y-%m-%dT%H:%i:%s') -where CreateDate_org is not null and CreateDate is null; +WHERE CreateDate_org IS NOT NULL and CreateDate IS NULL; -/* 最終更新日時(日付型) がnullのレコードを抽出し、最終更新日時(文字型)を日付型に変換してセットする。 */ -update src06.hcp_web_medpass_user_mst set +/* 最終更新日時(日付型) がNULLのレコードを抽出し、最終更新日時(文字型)を日付型に変換してセットする。 */ +UPDATE src06.hcp_web_medpass_user_mst SET LastUpdate = STR_TO_DATE(LastUpdate_org, '%Y-%m-%dT%H:%i:%s') -where LastUpdate_org is not null and LastUpdate is null; +WHERE LastUpdate_org IS NOT NULL and LastUpdate IS NULL;