<?xml version="1.0" encoding="utf-8" ?>
<!--<sqlMap namespace="CLIP.e-Form.Consent.Dfh" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >-->
<sqlMap namespace="CLIP.e-Form.Consent.Knuh" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <statements>
    <statement id="GET_SEQUENCE" parameterClass="Code" resultClass="System.Int32">
      select ud1_num as seq
      from EFORM_CODE
      where main_cd = 'SEQUENCE'
      and sub_cd = #sub_cd#
      for update
    </statement>
    
    <insert id="SET_SEQUENCE" parameterClass="Code" >
      insert into EFORM_CODE
      (main_cd, sub_cd, cd_nm, ud1_num, seq_no, use_yn)
      values ('SEQUENCE', #sub_cd#, 'count', 1 , 1, 'Y')
    </insert>
    
    <update id="UPDATE_SEQUENCE" parameterClass="Code">
      update EFORM_CODE
      set ud1_num =  #ud1_num#
      where main_cd = 'SEQUENCE' and sub_cd = #sub_cd#
    </update>
  </statements>

</sqlMap>