The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* IF upper(p_Line_adj_rec.updated_flag) ='Y' and
upper(p_line_adj_rec.applied_flag) = 'Y' and
p_Line_adj_rec.change_reason_code is null THEN
l_return_status := FND_API.G_RET_STS_ERROR;
SELECT soagr.agreement_type_code
INTO l_agr_type_code
FROM oe_agreements soagr,
oe_order_lines oeordl
WHERE soarg.agreement_id = oeordl.agreement_id
AND oeordl.line_id = p_line_adj_rec.line_id;
SELECT 'IMP_DISCOUNT'
INTO l_price_adj_error
FROM DUAL
WHERE NOT EXISTS
(SELECT NULL
FROM oe_discounts sodsc,
oe_discount_lines sodls,
oe_price_break_lines sopbl,
oe_order_lines oeordl,
o_order_header oeordh
WHERE NVL(decode(sign(p_line_adj_rec.discount_line_id), -1, null,
p_line_adj_rec.discount_line_id), -99)=
NVL(sodls.discount_line_id(+),-99)
AND p_line_adj_rec.discount_id = sodsc.discount_id
AND ((p_percent =
nvl(sodsc.amount / oeordl.unit_list_price * 100,
nvl(sodsc.percent,
nvl((oeordl.unit_list_price - sodls.price ) /
oeordl.unit_list_price * 100,
nvl(sodls.amount / oeordl.unit_list_price * 100,
nvl(sodls.percent,
nvl((oeordl.unit_list_price - sopbl.price ) /
oeordl.unit_list_price * 100,
nvl(sopbl.amount / oeordl.unit_list_price
* 100,
nvl( sopbl.percent, 0 )))))))))
OR
(sodsc.override_allowed_flag = 'Y'))
AND oeordl.line_id = p_line_adj_rec.line_id
AND oeordl.header_id = oeordh.header_id
AND sodsc.price_list_id = oeordl.price_list_id
AND sodsc.discount_type_code = 'LINE_ITEM'
AND nvl(trunc(oeordl.pricing_date), sysdate)
BETWEEN nvl(sodsc.start_date_active,
nvl(trunc(oeordl.pricing_date), sysdate))
AND
Nvl(sodsc.end_date_active, nvl(trunc(oeordl.pricing_date),
sysdate) )
AND sodls.discount_id(+) = sodsc.discount_id
AND nvl(trunc(oeordl.pricing_date), sysdate) between
Nvl(sodls.start_date_active(+), nvl(trunc(oeordl.pricing_date),
sysdate) )
AND
Nvl(sodls.end_date_active(+), nvl(trunc(oeordl.pricing_date),
sysdate) )
AND NVL(sodls.entity_value, 'X' ) =
DECODE(sodls.entity_id,
1007, TO_CHAR(oeordh.order_type_id),
1001, TO_CHAR(oeordl.inventory_item_id),
1005, l_agr_type_code,
1006, TO_CHAR(oeordl.agreement_id),
1010, oeordl.pricing_attribute1,
1011, oeordl.pricing_attribute2,
1012, oeordl.pricing_attribute3,
1013, oeordl.pricing_attribute4,
1014, oeordl.pricing_attribute5,
1015, oeordl.pricing_attribute6,
1016, oeordl.pricing_attribute7,
1017, oeordl.pricing_attribute8,
1018, oeordl.pricing_attribute9,
1019, oeordl.pricing_attribute10,
1020, oeordl.pricing_attribute11,
1021, oeordl.pricing_attribute12,
1022, oeordl.pricing_attribute13,
1023, oeordl.pricing_attribute14,
1024, oeordl.pricing_attribute15,
1045, sodls.entity_value,
'X' )
AND decode (sodls.ENTITY_ID,
1045, oe_adj_privilege.check_item_category
(oeordl.inventory_item_id,
SODLS.ENTITY_VALUE,
l_organization_id)
,'Y') = 'Y'
AND sopbl.discount_line_id(+) = sodls.discount_line_id
AND nvl(trunc(oeordl.pricing_date), sysdate)
BETWEEN
NVL( sopbl.start_date_active(+), nvl(trunc(oeordl.pricing_date),
sysdate) )
AND
NVL( sopbl.end_date_active(+), nvl(trunc(oeordl.pricing_date),
sysdate) )
AND DECODE( sopbl.method_type_code,
'UNITS', oeordl.quantity_ordered,
'DOLLARS', oeordl.quantity_ordered *
oeordl.unit_list_price, 0 )
BETWEEN NVL( sopbl.price_break_lines_low_range,
DECODE( sopbl.method_type_code,
'UNITS', oeordl.quantity_ordered,
'DOLLARS', oeordl.quantity_ordered *
oeordl.unit_list_price, 0 ))
AND NVL( sopbl.price_break_lines_high_range,
DECODE( sopbl.method_type_code,
'UNITS', oeordl.quantity_ordered,
'DOLLARS', oeordl.quantity_ordered *
oeordl.unit_list_price, 0 ))
AND (NOT EXISTS
(SELECT NULL
FROM oe_discount_customers sodcs
WHERE sodcs.discount_id = sodsc.discount_id )
OR
(EXISTS
(SELECT NULL
FROM oe_discount_customers sodcs
WHERE sodcs.discount_id = sodsc.discount_id
AND (sodcs.sold_to_org_id = oeordh.sold_to_org_id
OR
(sodcs.sold_to_org_id IS NULL
AND
sodcs.customer_class_code IS NULL))
AND (Nvl(sodcs.site_use_id, oeordh.ship_to_org_id)=
oeordh.ship_to_org_id
OR
NVL(sodcs.site_use_id, oeordh.invoice_to_org_id)=
oeordh.invoice_to_org_id )
AND nvl(trunc(oeordl.pricing_date), sysdate)
BETWEEN NVL( sodcs.start_date_active,
nvl(trunc(oeordl.pricing_date), sysdate) )
AND
NVL(sodcs.end_date_active,
nvl(trunc(oeordl.pricing_date), sysdate))
)
OR
EXISTS (SELECT NULL
FROM oe_discount_customers oecst,
hz_cust_accounsts hzcst
WHERE oecst.discount_id = sodsc.discount_id
AND hzcst.cust_account_id = oeordh.sold_to_org_id
AND hzcst.customer_class_code =
oecst.customer_class_code
AND oecst.sold_to_org_id IS NULL
AND oecst.site_use_id IS NULL
AND nvl(trunc(oeordl.pricing_date), sysdate)
BETWEEN NVL(oecst.start_date_active,
Nvl(trunc(oeordl.pricing_date),
Sysdate) )
AND
NVL(oecst.end_date_active,
nvl(trunc(oeordl.pricing_date), sysdate)))
)
)
);
SELECT 'VALID'
INTO l_tmp_string
FROM QP_LOOKUPS
WHERE LOOKUP_TYPE = p_Line_Adj_rec.charge_type_code
AND LOOKUP_CODE = p_Line_Adj_rec.charge_subtype_code
AND TRUNC(sysdate) BETWEEN TRUNC(NVL(START_DATE_ACTIVE,sysdate))
AND TRUNC(NVL(END_DATE_ACTIVE,sysdate))
AND ENABLED_FLAG = 'Y';
IF p_Line_Adj_rec.last_update_date IS NOT NULL AND
( p_Line_Adj_rec.last_update_date <>
p_old_Line_Adj_rec.last_update_date OR
p_old_Line_Adj_rec.last_update_date IS NULL )
THEN
IF NOT OE_Validate_adj.Last_Update_Date(p_Line_Adj_rec.last_update_date) THEN
oe_debug_pub.add(' Error last_update_date');
IF p_Line_Adj_rec.last_updated_by IS NOT NULL AND
( p_Line_Adj_rec.last_updated_by <>
p_old_Line_Adj_rec.last_updated_by OR
p_old_Line_Adj_rec.last_updated_by IS NULL )
THEN
IF NOT OE_Validate_adj.Last_Updated_By(p_Line_Adj_rec.last_updated_by) THEN
oe_debug_pub.add(' Error last_updated_by');
IF p_Line_Adj_rec.last_update_login IS NOT NULL AND
( p_Line_Adj_rec.last_update_login <>
p_old_Line_Adj_rec.last_update_login OR
p_old_Line_Adj_rec.last_update_login IS NULL )
THEN
IF NOT OE_Validate_adj.Last_Update_Login(p_Line_Adj_rec.last_update_login) THEN
oe_debug_pub.add(' Error last_update_login');
IF p_Line_Adj_rec.program_update_date IS NOT NULL AND
( p_Line_Adj_rec.program_update_date <>
p_old_Line_Adj_rec.program_update_date OR
p_old_Line_Adj_rec.program_update_date IS NULL )
THEN
IF NOT OE_Validate_adj.Program_Update_Date(p_Line_Adj_rec.program_update_date) THEN
oe_debug_pub.add(' Error program_update_date');
IF p_Line_Adj_rec.updated_flag IS NOT NULL AND
( p_Line_Adj_rec.updated_flag <>
p_old_Line_Adj_rec.updated_flag OR
p_old_Line_Adj_rec.updated_flag IS NULL )
THEN
IF NOT OE_Validate_adj.updated_flag(p_Line_Adj_rec.updated_flag) THEN
oe_debug_pub.add(' Error updated_flag');
IF p_Line_Adj_rec.update_allowed IS NOT NULL AND
( p_Line_Adj_rec.update_allowed <>
p_old_Line_Adj_rec.update_allowed OR
p_old_Line_Adj_rec.update_allowed IS NULL )
THEN
IF NOT OE_Validate_adj.update_allowed(p_Line_Adj_rec.update_allowed) THEN
oe_debug_pub.add(' Erro update_allowed');
PROCEDURE Entity_Delete
( x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
, p_Line_Adj_rec IN OE_Order_PUB.Line_Adj_Rec_Type
)
IS
l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
, 'Entity_Delete'
);
END Entity_Delete;