IFNULL -> NVL, 추가: now, today 오라클 버젼

master
mjkhan21 11 months ago
parent dbfc2ad825
commit 55d1d72766

@ -20,16 +20,23 @@ SELECT FOUND_ROWS() TOT_CNT</select>
<sql id="orderBy"><if test="fetchSize == null or fetchSize &lt; 1"><include refid="utility.sortBy" /></if></sql> <sql id="orderBy"><if test="fetchSize == null or fetchSize &lt; 1"><include refid="utility.sortBy" /></if></sql>
<sql id="now">DATE_FORMAT(CURRENT_TIMESTAMP(), '%Y%m%d%H%i%s')</sql> <!-- 마리아 DB -->
<sql id="now">DATE_FORMAT(CURRENT_TIMESTAMP, '%Y%m%d%H%i%s')</sql>
<sql id="selectNow">SELECT<include refid="utility.now" />NOW</sql>
<sql id="today">DATE_FORMAT(CURRENT_DATE, '%Y%m%d')</sql> <sql id="today">DATE_FORMAT(CURRENT_DATE, '%Y%m%d')</sql>
<sql id="selectToday">SELECT<include refid="utility.today" />TODAY</sql> <!-- 오라클
<sql id="now">TO_CHAR(CURRENT_TIMESTAMP, 'YYYYMMDDHH24MISS')</sql>
<sql id="today">TO_CHAR(CURRENT_DATE, 'YYYYMMDD')</sql>
-->
<sql id="selectNow">SELECT<include refid="utility.now" />NOW FROM DUAL</sql>
<sql id="selectToday">SELECT<include refid="utility.today" />TODAY FROM DUAL</sql>
<sql id="thisDay">IFNULL(#{thisDay},<include refid="utility.today" />)</sql> <sql id="thisDay">NVL(#{thisDay},<include refid="utility.today" />)</sql>
<sql id="selectThisDay">SELECT<include refid="utility.thisDay" />THIS_DAY</sql> <sql id="selectThisDay">SELECT<include refid="utility.thisDay" />THIS_DAY FROM DUAL</sql>
</mapper> </mapper>

@ -208,7 +208,7 @@ SELECT CASE WHEN LENGTH(STDG_LI_NM) > 0 THEN
<selectKey keyProperty="info.bsc_mttr_id" resultType="string" order="BEFORE"> <selectKey keyProperty="info.bsc_mttr_id" resultType="string" order="BEFORE">
SELECT CONCAT( SELECT CONCAT(
<include refid="utility.today" /> <include refid="utility.today" />
, LPAD(IFNULL(SUBSTRING(MAX(BSC_MTTR_ID), 9) + 1, 1), 22, '0') , LPAD(NVL(SUBSTRING(MAX(BSC_MTTR_ID), 9) + 1, 1), 22, '0')
) NEW_ID ) NEW_ID
FROM TB_CAR_BSC_MTTR TCBM FROM TB_CAR_BSC_MTTR TCBM
WHERE BSC_MTTR_ID LIKE CONCAT(<include refid="utility.today" />, '%')</selectKey> WHERE BSC_MTTR_ID LIKE CONCAT(<include refid="utility.today" />, '%')</selectKey>
@ -618,7 +618,7 @@ SELECT PRYE <!-- 연식 -->
<selectKey keyProperty="info.bsc_mttr_id" resultType="string" order="BEFORE"> <selectKey keyProperty="info.bsc_mttr_id" resultType="string" order="BEFORE">
SELECT CONCAT( SELECT CONCAT(
<include refid="utility.today" /> <include refid="utility.today" />
, LPAD(IFNULL(SUBSTRING(MAX(BSC_MTTR_ID), 9) + 1, 1), 22, '0') , LPAD(NVL(SUBSTRING(MAX(BSC_MTTR_ID), 9) + 1, 1), 22, '0')
) NEW_ID ) NEW_ID
FROM TB_CAR_BSC_MTTR TCBM FROM TB_CAR_BSC_MTTR TCBM
WHERE BSC_MTTR_ID LIKE CONCAT(<include refid="utility.today" />, '%')</selectKey> WHERE BSC_MTTR_ID LIKE CONCAT(<include refid="utility.today" />, '%')</selectKey>

Loading…
Cancel
Save