The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT
currency_code
, rate
FROM
PO_REQUISITION_LINES_ALL
WHERE requisition_header_id = pn_req_header_id
AND requisition_line_id = pn_req_line_id ;
SELECT
NVL(inclusive_tax_flag,'N')
, NVL(mod_cr_percentage,0)
, NVL(rounding_factor,0)
, tax_type
FROM
jai_cmn_taxes_all
WHERE tax_id = pn_tax_id;
SELECT
tax_id
, NVL(tax_amount,0)
, currency
, requisition_line_id
, NVL(modvat_flag,'N') --add by Xiao Lv for IL po notification on Mar-25-2009
FROM
JAI_PO_REQ_LINE_TAXES
WHERE REQUISITION_HEADER_ID = pn_document_id
AND REQUISITION_LINE_ID = NVL(pn_requisition_line_id, REQUISITION_LINE_ID); --add by Xiao
SELECT
tax_id
, NVL(tax_amount, 0)
, currency
, NVL(modvat_flag,'N') --add by Xiao Lv for IL po notification on Mar-25-2009
FROM
JAI_PO_TAXES
WHERE PO_HEADER_ID = pn_document_id;
SELECT
JPT.tax_id
, NVL(JPT.tax_amount,0)
, JPT.currency
, NVL(JPT.modvat_flag,'N') --add by Xiao Lv for IL po notification on Mar-25-2009
FROM
PO_LINE_LOCATIONS_ALL PLLA
, JAI_PO_TAXES JPT
WHERE PLLA.LINE_LOCATION_ID = JPT.LINE_LOCATION_ID
AND PLLA.PO_RELEASE_ID = pn_document_id;
SELECT
POA.PO_HEADER_ID
FROM
PO_RELEASES_ALL POA
WHERE POA.PO_RELEASE_ID = pn_document_id;
SELECT
jprlt.tax_id
, jprlt.tax_amount
, jprlt.currency
, NVL(jprlt.modvat_flag,'N')
, NVL(jcta.adhoc_flag, 'N')
FROM
JAI_PO_REQ_LINE_TAXES jprlt
, JAI_CMN_TAXES_ALL jcta
WHERE jcta.tax_id = jprlt.tax_id
AND jprlt.requisition_line_id = ln_req_line_id
AND jprlt.REQUISITION_HEADER_ID = pn_document_id;
SELECT
document_line_id
, NVL(old_quantity,1)
, NVL(new_quantity,0)
FROM
po_change_requests
WHERE document_header_id = pn_document_id
and request_level='LINE'
and change_request_group_id =pn_chg_request_group_id;
SELECT
tax_id
, tax_amount
, currency
, requisition_line_id
, modvat_flag
FROM
JAI_PO_REQ_LINE_TAXES
WHERE REQUISITION_HEADER_ID = pn_document_id
AND requisition_line_id = NVL(pn_line_id, requisition_line_id);
SELECT
tax_id
, tax_amount
, currency
, modvat_flag
FROM
JAI_PO_TAXES
WHERE PO_HEADER_ID = pn_document_id
AND po_line_id = NVL(pn_line_id, po_line_id)
And line_location_id = NVL(pn_line_location_id, line_location_id);
SELECT
JPT.tax_id
, JPT.tax_amount
, JPT.currency
, JPT.modvat_flag
FROM
PO_RELEASES_ALL POA
, PO_LINE_LOCATIONS_ALL PLLA
, JAI_PO_TAXES JPT
WHERE PLLA.LINE_LOCATION_ID = JPT.LINE_LOCATION_ID
AND POA.PO_HEADER_ID = PLLA.PO_HEADER_ID
AND POA.PO_RELEASE_ID = PLLA.PO_RELEASE_ID
AND POA.RELEASE_NUM = pn_release_num
AND POA.PO_HEADER_ID = pn_document_id
AND PLLA.LINE_LOCATION_ID = pn_line_location_id ;
INSERT
INTO PO_SESSION_GT(
key
, num1
, num2
, num3
, num4
, num5
, num6
, char1
, char2
)
SELECT x_session_gt_key
, GET_POREQ_TAX( JAI_PO_WF_UTIL_PUB.G_PO_DOC_TYPE
, poh.po_header_id
, NULL
, pol.po_line_id
, poll.line_location_id)
* nvl(pod.rate,1)
, NULL
, pod.code_combination_id
, poll.ship_to_location_id + 0
, pol.item_id
, pol.category_id
, DECODE(nvl(pol.cancel_flag, 'N')
, 'N'
, NVL(poll.cancel_flag, 'N')
, pol.cancel_flag)
, DECODE(nvl(pol.closed_code, 'OPEN')
, 'OPEN'
, NVL(poll.closed_code, 'OPEN')
, pol.closed_code)
FROM po_headers poh
, po_lines pol
, po_line_locations poll
, po_distributions pod
WHERE poh.po_header_id = p_document_id
AND pol.po_header_id = poh.po_header_id
AND poll.po_line_id = pol.po_line_id
AND poll.shipment_type <> 'PREPAYMENT' --
AND pod.line_location_id = poll.line_location_id
AND ((poh.type_lookup_code <> 'PLANNED') OR
((poh.type_lookup_code = 'PLANNED') AND
(poll.shipment_type = 'PLANNED')))
AND pod.distribution_num=1;
INSERT
INTO PO_SESSION_GT(
key
, num1
, num2
, num3
, num4
, num5
, num6
, char1
, char2
)
SELECT x_session_gt_key
, GET_POREQ_TAX( JAI_PO_WF_UTIL_PUB.G_REQ_DOC_TYPE
, porl.requisition_header_id
, NULL
, porl.requisition_line_id
, NULL )
, NULL
, pord.code_combination_id
, porl.deliver_to_location_id
, porl.item_id
, porl.category_id
, 'N'
, 'OPEN' -- Bug 4610058
FROM po_req_distributions pord
, po_requisition_lines porl
WHERE porl.requisition_header_id = p_document_id
AND porl.requisition_line_id = pord.requisition_line_id
AND NVL(porl.cancel_flag, 'N') = 'N'
AND NVL(porl.modified_by_agent_flag, 'N') = 'N'
AND pord.distribution_num=1;
INSERT
INTO PO_SESSION_GT(
key
, num1
, num2
, num3
, num4
, num5
, num6
, char1
, char2
)
SELECT x_session_gt_key
, GET_POREQ_TAX( JAI_PO_WF_UTIL_PUB.G_REL_DOC_TYPE
, pod.po_header_id
, poa.release_num
, pol.po_line_id
, poll.line_location_id
)
* NVL(pod.rate,1)
, NULL
, pod.code_combination_id
, poll.ship_to_location_id
, pol.item_id
, pol.category_id
, DECODE(nvl(pol.cancel_flag, 'N'), 'N', NVL(poll.cancel_flag, 'N'), pol.cancel_flag)
, DECODE(nvl(pol.closed_code, 'OPEN'), 'OPEN', NVL(poll.closed_code, 'OPEN'), pol.closed_code)
FROM po_distributions pod
, po_line_locations poll
, po_lines pol
, po_releases_all poa
WHERE poa.po_release_id = p_document_id
AND poll.po_release_id = p_document_id
AND poll.po_line_id = pol.po_line_id
AND pod.line_location_id = poll.line_location_id
AND pod.distribution_num = 1;