<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[select fam.table_name,
             fam.table_pk_value,
             fam.record_id,
             faa.attachment_id,
             faa.file_name,
             faa.file_path
  from prj_cdd_item_doc_ref     doc,
       fnd_atm_attachment_multi fam,
       fnd_atm_attachment       faa
 where doc.document_id = ${@table_pk_value}
   and doc.document_table IN ('CON_CONTRACT','CON_CONTRACT_CREDIT')
   and fam.table_name = 'PRJ_CDD_ITEM_CHECK'
   and fam.table_pk_value = doc.check_id
   and fam.attachment_id = faa.attachment_id]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="table_pk_value"/>
                <bm:parameter name="table_name"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME" required="true"/>
        <bm:field name="table_pk_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_PK_VALUE" required="true"/>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" required="true"/>
        <bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID" required="true"/>
        <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
        <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
    </bm:fields>
</bm:model>
