<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:fields>
        <bm:field name="attachment_id"/>
        <bm:field name="source_pk_value"/>
        <bm:field name="file_path"/>
        <bm:field name="file_size"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
select F.ATTACHMENT_ID,
       F.SOURCE_PK_VALUE,
       f.source_type_code,
       F.FILE_PATH,
       F.FILE_SIZE,
       f.creation_date,
       f.file_name,
       F.rowid
  from fnd_atm_attachment f
 where f.creation_date between to_date('2021-04-24','yyyy-mm-dd') and to_date('2024-05-31','yyyy-mm-dd')
  and f.File_Path like ${@ele_con_file_path}||'%' and f.if_same is null and rownum<501
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                BEGIN
                 UPDATE fnd_atm_attachment f
                 set f.if_same = ${@if_same},
                     f.new_file_size = ${@new_file_size},
                     f.last_update_date=sysdate,
                     f.last_updated_by= nvl(${/session/@user_id},1)
                     where f.attachment_id=${@attachment_id}
                     and f.source_pk_value=${@source_pk_value};
                     COMMIT;
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
