<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
               select a.company_id,
       a.parent_company_id,
       a.company_code || '-' || a.company_short_name company_name
  from (select v.company_id,
               t.parent_company_id,
               v.company_code,
               v.company_short_name
          from fnd_company_hierarchy_detail t, fnd_companies v
         where v.company_id = t.company_id(+)
           and sysdate between v.start_date_active and
               nvl(v.end_date_active, sysdate)
        connect by prior v.company_id = t.parent_company_id
         start with t.parent_company_id is null
         group by v.company_id,
                  t.parent_company_id,
                  v.company_code,
                  v.company_short_name
         order by v.company_code) a
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
