SELECT A.CMPN_CD AS CMPN_CD , A.SITE_CD AS SITE_CD , A.COVEND_ID AS COVEND_ID , A.CONT_SEQ AS CONT_SEQ , A.JOB_GB_CD AS JOB_GB_CD , A.CONT_ID AS CONT_ID , A.CONT_MOD_ID AS CONT_MOD_ID , A.MOD_NO AS MOD_NO , A.PO_DOC_NO AS PO_DOC_NO , A.CONT_NM AS CONT_NM , A.CONT_DT AS CONT_DT , A.COVEND_NM AS COVEND_NM , A.COVEND_CORP_REG_NO AS COVEND_CORP_REG_NO , A.CONT_AMT AS CONT_AMT , A.CONT_SUPPLY_AMT AS CONT_SUPPLY_AMT , A.CONT_TERM AS CONT_TERM , TO_CHAR(CONT_START_DT, 'YYYY-MM-DD') AS CONT_START_DT , TO_CHAR(CONT_END_DT, 'YYYY-MM-DD') AS CONT_END_DT , A.CONT_GB AS CONT_GB , A.STATUS_CD AS STATUS_CD , A.TEMPLATE_CD AS TEMPLATE_CD , A.TEMPLATE_NM AS TEMPLATE_NM , A.CHG_CONT_YN AS CHG_CONT_YN , A.CUR_GB AS CUR_GB , A.ADJ_GB AS ADJ_GB , A.RMK_CN AS RMK_CN , A.CRT_SYS_CD AS CRT_SYS_CD , TO_CHAR(WRTE_DT, 'YYYY-MM-DD') AS WRTE_DT , A.WRTE_PR AS WRTE_PR , TO_CHAR(MDFT_DT, 'YYYY-MM-DD') AS MDFT_DT , A.MDFT_PR AS MDFT_PR FROM TCS_SITE_TRADE A WHERE 1=1 ORDER BY 1
SELECT A.CMPN_CD AS CMPN_CD , A.SITE_CD AS SITE_CD , A.COVEND_ID AS COVEND_ID , A.CONT_SEQ AS CONT_SEQ , A.JOB_GB_CD AS JOB_GB_CD , A.CONT_ID AS CONT_ID , A.CONT_MOD_ID AS CONT_MOD_ID , A.MOD_NO AS MOD_NO , A.PO_DOC_NO AS PO_DOC_NO , A.CONT_NM AS CONT_NM , A.CONT_DT AS CONT_DT , A.COVEND_NM AS COVEND_NM , A.COVEND_CORP_REG_NO AS COVEND_CORP_REG_NO , A.CONT_AMT AS CONT_AMT , A.CONT_SUPPLY_AMT AS CONT_SUPPLY_AMT , A.CONT_TERM AS CONT_TERM , TO_CHAR(CONT_START_DT, 'YYYY-MM-DD') AS CONT_START_DT , TO_CHAR(CONT_END_DT, 'YYYY-MM-DD') AS CONT_END_DT , A.CONT_GB AS CONT_GB , A.STATUS_CD AS STATUS_CD , A.TEMPLATE_CD AS TEMPLATE_CD , A.TEMPLATE_NM AS TEMPLATE_NM , A.CHG_CONT_YN AS CHG_CONT_YN , A.CUR_GB AS CUR_GB , A.ADJ_GB AS ADJ_GB , A.RMK_CN AS RMK_CN , A.CRT_SYS_CD AS CRT_SYS_CD , TO_CHAR(WRTE_DT, 'YYYY-MM-DD') AS WRTE_DT , A.WRTE_PR AS WRTE_PR , TO_CHAR(MDFT_DT, 'YYYY-MM-DD') AS MDFT_DT , A.MDFT_PR AS MDFT_PR FROM TCS_SITE_TRADE A WHERE CMPN_CD = #{cmpnCd} AND SITE_CD = #{siteCd} AND COVEND_ID = #{covendId} AND CONT_SEQ = #{contSeq}
INSERT INTO TCS_SITE_TRADE ( A.CMPN_CD AS CMPN_CD , A.SITE_CD AS SITE_CD , A.COVEND_ID AS COVEND_ID , A.CONT_SEQ AS CONT_SEQ , A.JOB_GB_CD AS JOB_GB_CD , A.CONT_ID AS CONT_ID , A.CONT_MOD_ID AS CONT_MOD_ID , A.MOD_NO AS MOD_NO , A.PO_DOC_NO AS PO_DOC_NO , A.CONT_NM AS CONT_NM , A.CONT_DT AS CONT_DT , A.COVEND_NM AS COVEND_NM , A.COVEND_CORP_REG_NO AS COVEND_CORP_REG_NO , A.CONT_AMT AS CONT_AMT , A.CONT_SUPPLY_AMT AS CONT_SUPPLY_AMT , A.CONT_TERM AS CONT_TERM , TO_CHAR(CONT_START_DT, 'YYYY-MM-DD') AS CONT_START_DT , TO_CHAR(CONT_END_DT, 'YYYY-MM-DD') AS CONT_END_DT , A.CONT_GB AS CONT_GB , A.STATUS_CD AS STATUS_CD , A.TEMPLATE_CD AS TEMPLATE_CD , A.TEMPLATE_NM AS TEMPLATE_NM , A.CHG_CONT_YN AS CHG_CONT_YN , A.CUR_GB AS CUR_GB , A.ADJ_GB AS ADJ_GB , A.RMK_CN AS RMK_CN , A.CRT_SYS_CD AS CRT_SYS_CD , TO_CHAR(WRTE_DT, 'YYYY-MM-DD') AS WRTE_DT , A.WRTE_PR AS WRTE_PR , TO_CHAR(MDFT_DT, 'YYYY-MM-DD') AS MDFT_DT , A.MDFT_PR AS MDFT_PR ) VALUES ( #{cmpnCd} , #{siteCd} , #{covendId} , #{contSeq} , #{jobGbCd} , #{contId} , #{contModId} , #{modNo} , #{poDocNo} , #{contNm} , #{contDt} , #{covendNm} , #{covendCorpRegNo} , #{contAmt} , #{contSupplyAmt} , #{contTerm} , SYSDATE , SYSDATE , #{contGb} , #{statusCd} , #{templateCd} , #{templateNm} , #{chgContYn} , #{curGb} , #{adjGb} , #{rmkCn} , #{crtSysCd} , SYSDATE , #{wrtePr} , SYSDATE , #{mdftPr} )
UPDATE TCS_SITE_TRADE SET CMPN_CD = #{cmpnCd} , SITE_CD = #{siteCd} , COVEND_ID = #{covendId} , CONT_SEQ = #{contSeq} , JOB_GB_CD = #{jobGbCd} , CONT_ID = #{contId} , CONT_MOD_ID = #{contModId} , MOD_NO = #{modNo} , PO_DOC_NO = #{poDocNo} , CONT_NM = #{contNm} , CONT_DT = #{contDt} , COVEND_NM = #{covendNm} , COVEND_CORP_REG_NO = #{covendCorpRegNo} , CONT_AMT = #{contAmt} , CONT_SUPPLY_AMT = #{contSupplyAmt} , CONT_TERM = #{contTerm} , CONT_START_DT = SYSDATE , CONT_END_DT = SYSDATE , CONT_GB = #{contGb} , STATUS_CD = #{statusCd} , TEMPLATE_CD = #{templateCd} , TEMPLATE_NM = #{templateNm} , CHG_CONT_YN = #{chgContYn} , CUR_GB = #{curGb} , ADJ_GB = #{adjGb} , RMK_CN = #{rmkCn} , CRT_SYS_CD = #{crtSysCd} , WRTE_DT = SYSDATE , WRTE_PR = #{wrtePr} , MDFT_DT = SYSDATE , MDFT_PR = #{mdftPr} WHERE CMPN_CD = #{cmpnCd} AND SITE_CD = #{siteCd} AND COVEND_ID = #{covendId} AND CONT_SEQ = #{contSeq}
DELETE TCS_SITE_TRADE WHERE CMPN_CD = #{cmpnCd} AND SITE_CD = #{siteCd} AND COVEND_ID = #{covendId} AND CONT_SEQ = #{contSeq}