INSERT INTO
  #{dynamic_securityFlow}.tlk_ShareholderInformation (
    PARENT,
    LASTMODIFIED,
    FORMNAME,
    STATE,
    AUDITUSER,
    AUDITDATE,
    AUTHOR,
    AUTHOR_DEPT_INDEX,
    CREATED,
    FORMID,
    ISTMP,
    VERSIONS,
    APPLICATIONID,
    STATEINT,
    STATELABEL,
    AUDITORNAMES,
    LASTFLOWOPERATION,
    LASTMODIFIER,
    DOMAINID,
    AUDITORLIST,
    COAUDITORLIST,
    STATELABELINFO,
    PREVAUDITNODE,
    PREVAUDITUSER,
    OPTIONITEM,
    SIGN,
    KINGGRIDSIGNATURE,
    ITEM_topId,
    ITEM_shareholderType,
    ITEM_shareholder,
    ITEM_documentType,
    ITEM_documentID,
    ITEM_capitalContribution,
    ITEM_stockProportion,
    ITEM_address,
    ITEM_domain_id,
    ITEM_sex,
    ITEM_nationality,
    ITEM_nation,
    ITEM_household,
    ID,
    AUTHORDEPTID,
    AUTHOR_USER_INDEX,
    SUBFORMIDS,
    INITIATOR
  )
VALUES
  (
    '#{PARENT}',
    '#{LASTMODIFIED}',
    '#{FORMNAME}',
    '#{STATE}',
    '#{AUDITUSER}',
    '#{AUDITDATE}',
    '#{AUTHOR}',
    '#{AUTHOR_DEPT_INDEX}',
    '#{CREATED}',
    '__XcYfNIXJuFBcI9nncn4',
    0,
    1,
    '__wGomeHJBz6CpLFCCl4y',
    '#{STATEINT}',
    '#{STATELABEL}',
    '#{AUDITORNAMES}',
    '#{LASTFLOWOPERATION}',
    '#{LASTMODIFIER}',
    '#{dynamic_domain_id}',
    '#{AUDITORLIST}',
    '#{COAUDITORLIST}',
    '#{STATELABELINFO}',
    '#{PREVAUDITNODE}',
    '#{PREVAUDITUSER}',
    '#{OPTIONITEM}',
    '#{SIGN}',
    '#{KINGGRIDSIGNATURE}',
    '#{ITEM_topId}',
    '#{ITEM_shareholderType}',
    '#{ITEM_shareholder}',
    '#{ITEM_documentType}',
    '#{ITEM_documentID}',
    '#{ITEM_capitalContribution}',
    '#{ITEM_stockProportion}',
    '#{ITEM_address}',
    '#{ITEM_domain_id}',
    '#{ITEM_sex}',
    '#{ITEM_nationality}',
    '#{ITEM_nation}',
    '#{ITEM_household}',
    '#{ID}',
    '#{AUTHORDEPTID}',
    '#{AUTHOR_USER_INDEX}',
    '#{SUBFORMIDS}',
    '#{INITIATOR}'
  ) ON DUPLICATE KEY
UPDATE APPLICATIONID='__wGomeHJBz6CpLFCCl4y';

UPDATE tlk_ShareholderInformation SET
  LASTMODIFIED = '#{LASTMODIFIED}',
  ITEM_topId = '#{ITEM_topId}',
  ITEM_shareholderType = '#{ITEM_shareholderType}',
  ITEM_shareholder = '#{ITEM_shareholder}',
  ITEM_documentType = '#{ITEM_documentType}',
  ITEM_documentID = '#{ITEM_documentID}',
  ITEM_capitalContribution = '#{ITEM_capitalContribution}',
  ITEM_stockProportion = '#{ITEM_stockProportion}',
  ITEM_address = '#{ITEM_address}',
  ITEM_domain_id = '#{ITEM_domain_id}',
  ITEM_sex = '#{ITEM_sex}',
  ITEM_nationality = '#{ITEM_nationality}',
  ITEM_nation = '#{ITEM_nation}',
  ITEM_household = '#{ITEM_household}'
WHERE ID='#{ID}' and LASTMODIFIED< '#{LASTMODIFIED}'