The following lines contain the word 'select', 'insert', 'update' or 'delete':
x_last_update_date DATE;
x_last_update_login NUMBER;
x_last_updated_by NUMBER;
SELECT DISTINCT ITEM_ID
FROM PO_AUTOSOURCE_RULES;
SELECT AUTOSOURCE_RULE_ID,
AUTOSOURCE_RULE_NAME,
START_DATE,
END_DATE,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
ATTRIBUTE_CATEGORY,
attribute1,
attribute2,
attribute3,
attribute4,
attribute5,
attribute6,
attribute7,
attribute8,
attribute9,
attribute10,
attribute11,
attribute12,
attribute13,
attribute14,
attribute15
FROM PO_AUTOSOURCE_RULES
WHERE ITEM_ID = x_item_id
ORDER BY start_date;
SELECT MRP_SOURCING_RULES_S.NEXTVAL
FROM SYS.DUAL;
SELECT MRP_SR_RECEIPT_ORG_S.NEXTVAL
FROM SYS.DUAL;
SELECT MRP_SR_ASSIGNMENTS_S.NEXTVAL
FROM SYS.DUAL;
SELECT /*+ INDEX(MRP_SR_ASSIGNMENTS MRP_SR_ASSIGNMENTS_N3)*/
count(*)
INTO x_dummy_count
FROM mrp_sr_assignments
WHERE inventory_item_id = x_item_id
AND assignment_set_id = x_assignment_set_id
AND sourcing_rule_type = 1
AND assignment_type = 3;
x_last_update_date,
x_last_update_login,
x_last_updated_by,
x_creation_date,
x_created_by,
x_ATTRIBUTE_CATEGORY,
x_attribute1,
x_attribute2,
x_attribute3,
x_attribute4,
x_attribute5,
x_attribute6,
x_attribute7,
x_attribute8,
x_attribute9,
x_attribute10,
x_attribute11,
x_attribute12,
x_attribute13,
x_attribute14,
x_attribute15 ;
INSERT INTO MRP_SOURCING_RULES(
sourcing_rule_id,
sourcing_rule_name,
status,
sourcing_rule_type,
last_update_date,
last_updated_by,
creation_date,
created_by,
last_update_login,
planning_active,
ATTRIBUTE_CATEGORY,
attribute1,
attribute2,
attribute3,
attribute4,
attribute5,
attribute6,
attribute7,
attribute8,
attribute9,
attribute10,
attribute11,
attribute12,
attribute13,
attribute14,
attribute15
) VALUES (
x_sourcing_rule_id,
x_autosource_rule_name,
1, -- status
1, -- sourcing_rule_type (1=SOURCING RULE)
x_last_update_date,
x_last_updated_by,
x_creation_date,
x_created_by,
x_last_update_login,
1, -- planning_active (1=ACTIVE)
x_ATTRIBUTE_CATEGORY,
x_attribute1,
x_attribute2,
x_attribute3,
x_attribute4,
x_attribute5,
x_attribute6,
x_attribute7,
x_attribute8,
x_attribute9,
x_attribute10,
x_attribute11,
x_attribute12,
x_attribute13,
x_attribute14,
x_attribute15
);
-- Get new sr_receipt_id and insert into mrp_sr_receipt_org
OPEN I2;
INSERT INTO MRP_SR_RECEIPT_ORG(
sr_receipt_id,
sourcing_rule_id,
effective_date,
disable_date,
last_update_date,
last_updated_by,
creation_date,
created_by,
last_update_login
) VALUES (
x_sr_receipt_id,
x_sourcing_rule_id,
x_start_date,
x_end_date,
x_last_update_date,
x_last_updated_by,
x_creation_date,
x_created_by,
x_last_update_login
);
select mtl.organization_id
into x_organization_id
from mtl_system_items msi, mtl_parameters mtl,
financials_system_parameters fsp --1776173
where msi.inventory_item_id = x_item_id
and msi.organization_id = fsp.inventory_organization_id --1776173
and msi.organization_id = mtl.master_organization_id
and msi.organization_id = mtl.organization_id;
select mtl.organization_id
into x_organization_id
from mtl_system_items msi, mtl_parameters mtl
where msi.inventory_item_id = x_item_id
and msi.organization_id = mtl.master_organization_id
and msi.organization_id = mtl.organization_id;
INSERT INTO MRP_SR_ASSIGNMENTS(
assignment_id,
assignment_type,
sourcing_rule_id,
sourcing_rule_type,
assignment_set_id,
last_update_date,
last_updated_by,
creation_date,
created_by,
last_update_login,
organization_id,
inventory_item_id
) VALUES (
x_assignment_id,
3, -- assignment_type (3=ITEM)
x_sourcing_rule_id,
1, -- sourcing_rule_type (1=SOURCING RULE)
x_assignment_set_id,
x_last_update_date,
x_last_updated_by,
x_creation_date,
x_created_by,
x_last_update_login,
x_organization_id,
x_item_id
);
UPDATE po_approved_supplier_list
SET request_id = null
WHERE request_id = -99;