<?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
                    tt.address
                FROM
                    (SELECT
                        *
                    FROM
                        AST_CAR_GPS_ADDRESS t1
                    WHERE
                        EXISTS
                        (SELECT
                            1
                        FROM
                            ast_car_gps acg
                        WHERE
                            acg.ast_car_gps_id = t1.ast_car_gps_id AND
                            acg.contract_id    = ${@contract_id}
                        )
                    ORDER BY
                        t1.last_update_date DESC
                    ) tt
                WHERE
                    rownum = 1
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>