The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT
jctl.customer_trx_id ,
jctl.gst_assessable_value ,
jcttl.customer_trx_line_id ,
jcttl.tax_id ,
jcttl.link_to_cust_trx_line_id ,
jcttl.func_tax_amount ,
jcttl.creation_date ,
jtc.tax_type ,
jcttl.tax_rate
FROM
JAI_AR_TRX_LINES jctl ,
JAI_AR_TRX_TAX_LINES jcttl ,
JAI_CMN_TAXES_ALL jtc ,
(
SELECT jrttv1.tax_type tax_type
FROM jai_regime_tax_types_v jrttv1
WHERE jrttv1.regime_code = cpv_regime_code
) jrttv
WHERE
jctl.customer_trx_id = pn_customer_trx_id AND
jctl.customer_trx_line_id = jcttl.link_to_cust_trx_line_id AND
jcttl.tax_id = jtc.tax_id AND
jtc.tax_type = jrttv.tax_type AND
NOT EXISTS ( SELECT 1
FROM jai_rgm_trx_records jrtr
WHERE jrtr.source = cpv_source AND
jrtr.source_trx_type = cpv_source_trx_type AND
jrtr.organization_id = pn_organization_id AND
jrtr.location_id = pn_location_id AND
jrtr.source_table_name = cpv_source_table_name AND
jrtr.attribute1 = pn_customer_trx_id AND
jrtr.source_document_id = jcttl.customer_trx_line_id AND
jrtr.reference_id = jcttl.tax_id
) ;
SELECT
jspl.delivery_id ,
jspl.delivery_detail_id ,
jspl.gst_assessable_value ,
jspl.order_line_id ,
jsptl.tax_id ,
jsptl.tax_rate ,
jsptl.tax_amount ,
jsptl.func_tax_amount ,
jsptl.creation_date ,
jtc.tax_type
FROM
JAI_OM_WSH_LINES_ALL jspl ,
JAI_OM_WSH_LINE_TAXES jsptl ,
JAI_CMN_TAXES_ALL jtc ,
(
SELECT jrttv1.tax_type tax_type
FROM jai_regime_tax_types_v jrttv1
WHERE jrttv1.regime_code = cpv_regime_code
) jrttv
WHERE
jspl.organization_id = pn_organization_id AND
jspl.location_id = pn_location_id AND
(
(jspl.delivery_id = pn_delivery_id
AND jspl.delivery_detail_id = jsptl.delivery_detail_id) OR
(jspl.order_line_id = pn_order_line_id
AND jspl.order_line_id = jsptl.order_line_id)
) AND
jsptl.tax_id = jtc.tax_id AND
jtc.tax_type = jrttv.tax_type AND
(cpv_source = jai_constants.source_wsh
OR cpv_source = jai_constants.source_nsh) AND
NOT EXISTS ( SELECT
1
FROM
jai_rgm_trx_records jrtr
WHERE
jrtr.source = cpv_source AND
jrtr.source_trx_type = cpv_source_trx_type AND
jrtr.organization_id = pn_organization_id AND
jrtr.location_id = pn_location_id AND
jrtr.source_table_name = cpv_source_table_name AND
((jrtr.trx_reference1 = jspl.delivery_id
AND jrtr.source_document_id = jspl.delivery_detail_id) OR
(jrtr.trx_reference2 = jspl.order_line_id
AND jrtr.source_document_id = jspl.order_line_id)
) AND
jrtr.reference_id = jsptl.tax_id
)
;
SELECT regime_code, tax_type, source, source_table_name, source_document_id,
source_trx_type, organization_id
FROM jai_rgm_trx_records
WHERE repository_id = cpn_repository_id;