col list_line_type_code form a12
col arithmetic_operator form a12
Select h.order_number,
l.line_number,
pa.list_line_type_code,
pa.arithmetic_operator,
pa.operand,
DECODE(PA.MODIFIER_LEVEL_CODE,'ORDER',
L.UNIT_LIST_PRICE*L.ORDERED_QUANTITY *PA.OPERAND * SIGN(PA.ADJUSTED_AMOUNT)/100,
(PA.ADJUSTED_AMOUNT* NVL(L.ORDERED_QUANTITY,0) )) DISCOUNT_AMT
From
qp_list_headers_vl lh,
oe_price_adjustments pa,
oe_order_lines_all l,
oe_order_headers_all h
Where h.order_number = 14463
and h.header_id = l.header_id
and h.org_id = l.org_id
and h.header_id = pa.header_id
and l.line_id = pa.line_id(+)
and pa.list_header_id = lh.list_header_id
AND ( PA.LIST_LINE_TYPE_CODE = 'DIS'
OR PA.LIST_LINE_TYPE_CODE = 'SUR'
OR PA.LIST_LINE_TYPE_CODE = 'PBH' )
AND PA.APPLIED_FLAG='Y'
AND NOT EXISTS
(SELECT 'X'
FROM OE_PRICE_ADJ_ASSOCS PAS,
OE_PRICE_ADJUSTMENTS PA1
WHERE PAS.RLTD_PRICE_ADJ_ID =
PA.PRICE_ADJUSTMENT_ID
AND PA1.PRICE_ADJUSTMENT_ID=
PAS.PRICE_ADJUSTMENT_ID
AND PA1.LIST_LINE_TYPE_CODE ='PBH')
Order by l.line_id
/
a: Qp_list_headers_vl is view based on qp_list_headers_b and qp_list_headers_tl tables.
No comments:
Post a Comment