adb中我用str_to_date, 报错[HY000][1815] [40040, 2023041
查询一直不报错,插入 常量可以插入成功,变量不可以
replace INTO dwd.mdc_psn_bsc_infmt ( id_crd_no, bth_dt )WITH t5 as ( SELECT '13022119930229483X' as id_crd_no ,concat_ws('-',SUBSTR('13022119930229483X',7,4),SUBSTR('13022119930229483X',11,2),SUBSTR('13022119930229483X',13,2)) as date_info2)SELECT a.id_crd_no AS id_crd_no ,case when STR_TO_DATE('1993-02-29', '%Y-%m-%d') is null then null else STR_TO_DATE('1993-02-29', '%Y-%m-%d') end AS bth_dt --常量可以成功 -- ,case when STR_TO_DATE(a.date_info2, '%Y-%m-%d') is null then null else STR_TO_DATE(a.date_info2, '%Y-%m-%d') end AS bth_dt --变量成功不了FROM t5 a
赞0
踩0