The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE INSERT_RECORD(x_quota_id NUMBER, x_quota_rule_id NUMBER, x_revenue_class_id NUMBER)
IS
x_user_id NUMBER := fnd_global.user_id;
SELECT ORG_ID
INTO l_org_id
FROM CN_QUOTAS_ALL
WHERE QUOTA_ID = x_quota_id ;
INSERT INTO cn_trx_factors
(trx_factor_id,
quota_id,
quota_rule_id,
revenue_class_id,
trx_type,
event_factor,
created_by,
creation_date,
org_id,
object_version_number)
SELECT cn_trx_factors_s.NEXTVAL,
x_quota_id,
x_quota_rule_id,
x_revenue_class_id,
lookup_code,
DECODE(lookup_code,
'ORD', 0,
'PMT', 0,
100),
x_user_id,
SYSDATE,
l_org_id,
1
FROM cn_lookups
WHERE lookup_type = 'TRX TYPES'
AND lookup_code NOT IN ('BALANCE UPGRADE', 'UPGRADE');
END INSERT_RECORD;
PROCEDURE UPDATE_RECORD(
x_trx_factor_id NUMBER,
x_event_factor NUMBER,
x_event_factor_old NUMBER,
x_object_version_number IN OUT NOCOPY NUMBER,
x_revenue_class_id NUMBER,
x_last_update_date DATE,
x_last_updated_by NUMBER,
x_last_update_login NUMBER,
x_quota_id NUMBER,
x_quota_rule_id NUMBER,
x_trx_type VARCHAR2,
x_trx_type_name VARCHAR2,
x_status_code VARCHAR2)
IS
l_ovn NUMBER := 1 ;
SELECT NVL(OBJECT_VERSION_NUMBER,1)
INTO l_ovn
FROM CN_TRX_FACTORS
WHERE TRX_FACTOR_ID = x_trx_factor_id ;
UPDATE cn_trx_factors
SET trx_factor_id = x_trx_factor_id,
event_factor = x_event_factor,
last_update_date = x_last_update_date,
last_updated_by = x_last_updated_by,
last_update_login = x_last_update_login,
object_version_number = l_ovn
WHERE trx_factor_id = x_trx_factor_id;
END UPDATE_RECORD;
PROCEDURE DELETE_RECORD(x_trx_factor_id NUMBER, x_quota_rule_id NUMBER, x_quota_id NUMBER)
IS
BEGIN
IF NVL(g_temp_status_code, 'COMPLETE') <> 'FAILED'
THEN
IF x_quota_rule_id IS NOT NULL
THEN
-- called when deleting a quota rule
DELETE FROM cn_trx_factors
WHERE quota_rule_id = x_quota_rule_id;
DELETE FROM cn_trx_factors
WHERE quota_id = x_quota_id;
END DELETE_RECORD;
x_last_update_date DATE,
x_last_updated_by NUMBER,
x_creation_date DATE,
x_created_by NUMBER,
x_last_update_login NUMBER,
x_quota_id NUMBER,
x_quota_rule_id NUMBER,
x_trx_type VARCHAR2,
x_trx_type_name VARCHAR2,
x_program_type VARCHAR2,
x_status_code VARCHAR2,
x_org_id NUMBER)
IS
BEGIN
g_program_type := x_program_type;
IF x_operation = 'INSERT'
THEN
INSERT_RECORD(x_quota_id,
x_quota_rule_id,
x_revenue_class_id);
ELSIF x_operation = 'UPDATE'
THEN
UPDATE_RECORD(x_trx_factor_id,
x_event_factor,
x_event_factor_old,
x_object_version_number,
x_revenue_class_id,
x_last_update_date,
x_last_updated_by,
x_last_update_login,
x_quota_id,
x_quota_rule_id,
x_trx_type,
x_trx_type_name,
x_status_code);
ELSIF x_operation = 'DELETE'
THEN
DELETE_RECORD(x_trx_factor_id,
x_quota_rule_id,
x_quota_id);