The following lines contain the word 'select', 'insert', 'update' or 'delete':
FUNCTION Check_Delete_Agreement( p_Price_List_id IN NUMBER)
RETURN BOOLEAN;
ELSIF (l_Contract_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Contract_rec.operation = OE_GLOBALS.G_OPR_DELETE )
THEN
l_Contract_rec.db_flag := FND_API.G_TRUE;
IF ( l_contract_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_contract_rec.operation = OE_GLOBALS.G_OPR_CREATE
OR l_contract_rec.operation = OE_GLOBALS.G_OPR_DELETE) THEN
-- Attribute level validation.
IF l_control_rec.default_attributes
OR l_control_rec.change_attributes
THEN
IF p_validation_level > FND_API.G_VALID_LEVEL_NONE THEN
OE_Validate_Contract.Attributes
( x_return_status => l_return_status
, p_Contract_rec => l_Contract_rec
, p_old_Contract_rec => l_old_Contract_rec
);
IF l_Contract_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Validate_Contract.Entity_Delete
( x_return_status => l_return_status
, p_Contract_rec => l_Contract_rec
);
IF l_Contract_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Contract_Util.Delete_Row
( p_pricing_contract_id => l_Contract_rec.pricing_contract_id
);
l_Contract_rec.last_update_date := SYSDATE;
l_Contract_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_Contract_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
IF l_Contract_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
OE_Contract_Util.Update_Row (l_Contract_rec);
OE_Contract_Util.Insert_Row (l_Contract_rec);
l_Agreement_Delete_Flag BOOLEAN;
l_Agreement_Lines_Delete_Flag BOOLEAN;
ELSIF l_Agreement_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Agreement_rec.operation = OE_GLOBALS.G_OPR_DELETE
THEN
l_Agreement_rec.db_flag := FND_API.G_TRUE;
IF ( l_agreement_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_agreement_rec.operation = OE_GLOBALS.G_OPR_CREATE
OR l_agreement_rec.operation = OE_GLOBALS.G_OPR_DELETE) THEN
-- Attribute level validation.
IF l_control_rec.default_attributes
OR l_control_rec.change_attributes
THEN
IF p_validation_level > FND_API.G_VALID_LEVEL_NONE THEN
OE_Validate_Agreement.Attributes
( x_return_status => l_return_status
, p_Agreement_rec => l_Agreement_rec
, p_old_Agreement_rec => l_old_Agreement_rec
);
IF l_Agreement_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Validate_Agreement.Entity_Delete
( x_return_status => l_return_status
, p_Agreement_rec => l_Agreement_rec
);
IF l_Agreement_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
/* Check the price List associated with an agreement */
/* Bug 2321498 Commented following code as price List should not be deleted */
/*
oe_debug_pub.add('Geresh Before Check Delete Agreement');
if NOT ( Check_Delete_Agreement( p_Price_List_id => l_Agreement_rec.price_list_id )) THEN
l_Price_List_Exists_Flag := FALSE;
oe_debug_pub.add('Geresh After Check Delete Agreement'); */
l_Agreement_Delete_Flag := FALSE;
l_Agreement_Delete_Flag := TRUE;
l_Agreement_Lines_Delete_Flag := FALSE;
l_Agreement_Lines_Delete_Flag := TRUE;
OE_Agreement_Util.Delete_Row
( x_return_status => l_return_status
, p_agreement_id => l_Agreement_rec.agreement_id
, p_Price_List_Exists_Flag => l_Price_list_Exists_Flag
, p_Agreement_Delete_Flag => l_Agreement_Delete_Flag
, p_Agreement_Lines_Delete_Flag => l_Agreement_Lines_Delete_Flag
);
l_Agreement_rec.last_update_date := SYSDATE;
l_Agreement_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_Agreement_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
IF l_Agreement_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
OE_Agreement_Util.Update_Row (l_Agreement_rec);
select list_type_code into l_price_list_type_code from
qp_list_headers_vl where
list_header_id = l_Agreement_rec.price_list_id;
oe_debug_pub.add('before update create_agr_qual');
oe_debug_pub.add('after update create_agr_qual');
OE_Agreement_Util.Insert_Row (l_Agreement_rec);
select list_type_code into l_price_list_type_code from
qp_list_headers_vl where
list_header_id = l_Agreement_rec.price_list_id;
oe_debug_pub.add('before insert create_agr_qual');
oe_debug_pub.add('after insert create_agr_qual');
select list_type_code into l_price_list_type_code from
qp_list_headers_vl where
list_header_id = l_Agreement_rec.price_list_id;
ELSIF l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_DELETE
THEN
l_Price_LHeader_rec.db_flag := FND_API.G_TRUE;
IF ( l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_CREATE
OR l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_DELETE) THEN
-- Attribute level validation.
IF l_control_rec.default_attributes
OR l_control_rec.change_attributes
THEN
IF p_validation_level > FND_API.G_VALID_LEVEL_NONE THEN
OE_Validate_Price_List.Attributes
( x_return_status => l_return_status
, p_Price_LIST_rec => l_Price_LHeader_rec
, p_old_Price_LIST_rec => l_old_Price_LHeader_rec
);
IF l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Validate_Price_List.Entity_Delete
( x_return_status => l_return_status
, p_Price_list_rec => l_Price_LHeader_rec
);
IF l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Price_List_Util.Delete_Row
( p_name => l_Price_LHeader_rec.name,
p_price_list_id => l_Price_LHeader_rec.price_list_id
);
l_Price_LHeader_rec.last_update_date := SYSDATE;
l_Price_LHeader_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_Price_LHeader_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
IF l_Price_LHeader_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
OE_Price_List_Util.Update_Row (l_Price_LHeader_rec);
OE_Price_List_Util.Insert_Row (l_Price_LHeader_rec);
ELSIF l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_DELETE
THEN
l_Price_LLine_rec.db_flag := FND_API.G_TRUE;
IF ( l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_CREATE
OR l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_DELETE) THEN
-- Attribute level validation.
IF l_control_rec.default_attributes
OR l_control_rec.change_attributes
THEN
IF p_validation_level > FND_API.G_VALID_LEVEL_NONE THEN
OE_Validate_Price_List_Line.Attributes
( x_return_status => l_return_status
, p_PRICE_LIST_LINE_rec => l_Price_LLine_rec
, p_old_PRICE_LIST_LINE_rec => l_old_Price_LLine_rec
);
IF l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Validate_Price_List_Line.Entity_Delete
( x_return_status => l_return_status
, p_PRICE_LIST_LINE_rec => l_Price_LLine_rec
);
IF l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
OE_Price_List_Line_Util.Delete_Row
( p_price_list_line_id => l_Price_LLine_rec.price_list_line_id
);
l_Price_LLine_rec.last_update_date := SYSDATE;
l_Price_LLine_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_Price_LLine_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
IF l_Price_LLine_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
OE_Price_List_Line_Util.Update_Row (l_Price_LLine_rec);
OE_Price_List_Line_Util.Insert_Row (l_Price_LLine_rec );
ELSIF l_Price_Break_rec.operation = OE_GLOBALS.G_OPR_UPDATE
OR l_Price_Break_rec.operation = OE_GLOBALS.G_OPR_DELETE
THEN
l_Price_Break_rec.db_flag := FND_API.G_TRUE;
IF l_Price_Break_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
/*
OE_Validate_Price_Break.Entity_Delete
( x_return_status => l_return_status
, p_Price_Break_rec => l_Price_Break_rec
);
IF l_Price_Break_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
NULL;
/* OE_Price_Break_Util.Delete_Row
( p_discount_line_id => l_Price_Break_rec.discount_line_id
, p_method_type_code => l_Price_Break_rec.method_type_code
, p_price_break_high => l_Price_Break_rec.price_break_high
, p_price_break_low => l_Price_Break_rec.price_break_low
) ;
l_Price_Break_rec.last_update_date := SYSDATE;
l_Price_Break_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_Price_Break_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
IF l_Price_Break_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
NULL;
OE_Price_Break_Util.Update_Row (l_Price_Break_rec);
OE_Price_Break_Util.Insert_Row (l_Price_Break_rec);
NO_UPDATE_PRIVILEGE EXCEPTION;
IF p_Agreement_rec.operation = QP_GLOBALS.G_OPR_UPDATE THEN
-- Check the security privilege
IF p_Agreement_rec.price_list_id IS NOT NULL
THEN
IF QP_security.check_function( p_function_name => QP_Security.G_FUNCTION_UPDATE,
p_instance_type => QP_Security.G_PRICELIST_OBJECT,
p_instance_pk1 => p_Agreement_rec.price_list_id) = 'F'
THEN
fnd_message.set_name('QP', 'QP_NO_PRIVILEGE');
RAISE NO_UPDATE_PRIVILEGE;
WHEN NO_UPDATE_PRIVILEGE THEN
x_return_status := FND_API.G_RET_STS_SUCCESS;
FUNCTION Check_Delete_Agreement( p_Price_List_id IN NUMBER)
RETURN BOOLEAN
IS
l_price_list_id NUMBER;
SELECT count(*)
into l_count
from oe_agreements_b
where price_list_id = p_Price_List_id;
oe_debug_pub.add('Geresh In Check Delete Agreement' || p_Price_List_Id);
oe_debug_pub.add('Geresh In No Data Found Check Delete Agreement' || p_Price_List_Id);
oe_debug_pub.add('Geresh In No Data Found Check Delete Agreement' || p_Price_List_Id);
END Check_Delete_Agreement;
SELECT agreement_id into
l_agreement_id
from oe_order_lines
where agreement_id = p_Agreement_id;
Select 'N' into l_exist from dual where
not exists (select 1 from oe_order_lines
where agreement_id = p_Agreement_id);
SELECT agreement_id into
l_agreement_id
from oe_order_headers
where agreement_id = p_Agreement_id;
Select 'N' into l_exist from dual where
not exists (select 1 from oe_order_headers
where agreement_id = p_Agreement_id);
/*procedure added by spgopal 08/14/00 for duplication of qualifier on price list updates*/
/*
PROCEDURE Create_Agreement_Qualifier
(p_list_header_id IN NUMBER,
p_old_list_header_id IN NUMBER,
p_Agreement_id IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2); -- file.sql.39 change
elsif p_operation = OE_GLOBALS.G_OPR_UPDATE then
oe_debug_pub.add('in if update'||p_operation);
delete from qp_qualifiers where
list_header_id = p_old_list_header_id
and qualifier_context = 'CUSTOMER'
and qualifier_attribute = 'QUALIFIER_ATTRIBUTE7'
and qualifier_attr_value = p_agreement_id;
select count(list_header_id) into l_qual_count
from qp_qualifiers where
list_header_id = p_list_header_id
and qualifier_context = 'CUSTOMER'
and qualifier_attribute = 'QUALIFIER_ATTRIBUTE7'
and qualifier_attr_value = p_agreement_id;