The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT 1
FROM dual
WHERE EXISTS (SELECT 1
FROM mtl_secondary_inventories
WHERE secondary_inventory_name = P_whse_code
AND organization_id = P_organization_id);
SELECT *
FROM mtl_parameters
WHERE organization_id = V_organization_id;
--Now insert the warehouse into mtl_secondary_inventories table
mtl_secondary_inventories_pkg.insert_row (
x_rowid => l_rowid
, x_secondary_inventory_name => P_whse_code
, x_organization_id => P_organization_id
, x_last_update_date => SYSDATE
, x_last_updated_by => 0
, x_creation_date => SYSDATE
, x_created_by => 0
, x_last_update_login => 0
, x_description => p_whse_name
, x_disable_date => NULL
, x_inventory_atp_code => 1
, x_availability_type => 1
, x_reservable_type => 1
, x_locator_type => l_locator_type
, x_picking_order => NULL
, x_dropping_order => NULL
, x_material_account => l_details.material_account
, x_material_overhead_account => l_details.material_overhead_account
, x_resource_account => l_details.resource_account
, x_overhead_account => l_details.overhead_account
, x_outside_processing_account => l_details.outside_processing_account
, x_quantity_tracked => 1
, x_asset_inventory => 1
, x_source_type => NULL
, x_source_subinventory => NULL
, x_source_organization_id => NULL
, x_requisition_approval_type => NULL
, x_expense_account => l_details.expense_account
, x_encumbrance_account => l_details.encumbrance_account
, x_attribute_category => NULL
, x_attribute1 => NULL
, x_attribute2 => NULL
, x_attribute3 => NULL
, x_attribute4 => NULL
, x_attribute5 => NULL
, x_attribute6 => NULL
, x_attribute7 => NULL
, x_attribute8 => NULL
, x_attribute9 => NULL
, x_attribute10 => NULL
, x_attribute11 => NULL
, x_attribute12 => NULL
, x_attribute13 => NULL
, x_attribute14 => NULL
, x_attribute15 => NULL
, x_preprocessing_lead_time => NULL
, x_processing_lead_time => NULL
, x_postprocessing_lead_time => NULL
, x_demand_class => NULL
, x_project_id => NULL
, x_task_id => NULL
, x_subinventory_usage => NULL
, x_notify_list_id => NULL
, x_depreciable_flag => 2
, x_location_id => NULL
, x_status_id => 1
, x_default_loc_status_id => 1
, x_lpn_controlled_flag => 0
, x_default_cost_group_id => l_details.default_cost_group_id
, x_pick_uom_code => NULL
, x_cartonization_flag => 0
, x_planning_level => 2
, x_default_count_type_code => 2
, x_subinventory_type => 1
, x_enable_bulk_pick => 'N');
UPDATE IC_LOCT_MST
SET locator_id = inventory_location_id
WHERE whse_code = P_whse_code;
PROCEDURE update_organization (P_migration_run_id IN NUMBER,
P_commit IN VARCHAR2,
X_failure_count OUT NOCOPY NUMBER) IS
CURSOR Cur_get_orgn IS
SELECT organization_id, process_orgn_code
FROM mtl_parameters
WHERE process_enabled_flag = 'Y';
SELECT a.co_code
FROM sy_orgn_mst a, gl_plcy_mst b
WHERE a.co_code = b.co_code
AND a.orgn_code = V_orgn_code
AND b.new_le_flag = 'Y';
SELECT a.whse_code, a.whse_name
FROM ic_whse_mst a
WHERE mtl_organization_id = V_organization_id
AND NVL(subinventory_ind_flag, 'N') = 'N'
AND NVL(migrated_ind,0) = 0;
UPDATE mtl_parameters
SET lot_number_uniqueness = 2,
primary_cost_method = 1,
cost_organization_id = organization_id
WHERE process_enabled_flag = 'Y';
UPDATE mtl_parameters m
SET stock_locator_control_code = 4
WHERE organization_id = l_rec.organization_id
AND EXISTS (SELECT 1
FROM IC_WHSE_MST
WHERE loct_ctl > 0
AND mtl_organization_id = l_rec.organization_id);
UPDATE hr_organization_information
SET org_information2 = l_legal_entity
WHERE organization_id = l_rec.organization_id
AND org_information_context = 'Accounting Information';
/* Update the locator control for the existing subinventories to be determined at item level */
UPDATE mtl_secondary_inventories
SET locator_type = 5
WHERE organization_id = l_rec.organization_id
AND EXISTS (SELECT 1
FROM IC_WHSE_MST
WHERE loct_ctl > 0
AND mtl_organization_id = l_rec.organization_id);
/* Update secondary inventories table for any rows that had the default cost group id */
/* missing - due to an issue in the gmf_mtl_parameters_biur_tg trigger code - Bug 5553034*/
UPDATE mtl_secondary_inventories
SET default_cost_group_id = (SELECT default_cost_group_id
FROM mtl_parameters
WHERE organization_id = l_rec.organization_id)
WHERE default_cost_group_id IS NULL
AND organization_id = l_rec.organization_id
AND secondary_inventory_name <> 'AX_INTRANS';
UPDATE ic_whse_mst
SET migrated_ind = 1,
organization_id = mtl_organization_id
WHERE mtl_organization_id = l_rec.organization_id;
END update_organization;
/* Bug 5607797 - Changed the following select to return the inventory location id instead of 1 */
CURSOR Cur_check_sub_location(V_location VARCHAR2) IS
SELECT inventory_location_id
FROM mtl_item_locations
WHERE segment1 = V_location
AND subinventory_code = P_subinventory_code
AND organization_id = p_organization_id;
SELECT 1
FROM dual
WHERE EXISTS (SELECT 1
FROM mtl_item_locations
WHERE segment1 = V_location
AND organization_id = p_organization_id);
SELECT mtl_item_locations_s.nextval
FROM dual;
INSERT INTO mtl_item_locations(
inventory_location_id,organization_id,description,descriptive_text,disable_date,picking_order,location_maximum_units,
subinventory_code,location_weight_uom_code,max_weight,volume_uom_code,max_cubic_area,segment1,segment2,segment3,segment4,
segment5,segment6,segment7,segment8,segment9,segment10,segment11,segment12,segment13,segment14,segment15,segment16,
segment17,segment18,segment19,segment20,summary_flag,enabled_flag,start_date_active,end_date_active,attribute_category,
attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,
attribute11,attribute12,attribute13,attribute14,attribute15,project_id,task_id,physical_location_id,pick_uom_code,
dimension_uom_code,length,width,height,locator_status,status_id,current_cubic_area,available_cubic_area,current_weight,
available_weight,location_current_units,location_available_units,suggested_cubic_area,empty_flag,mixed_items_flag,
dropping_order,location_suggested_units,availability_type,inventory_atp_code,reservable_type,inventory_item_id,
creation_date,created_by,last_update_date,last_updated_by)
VALUES (
l_location_id,p_organization_id,l_loct_desc,NULL,p_disable_date,NULL,NULL,p_subinventory_code,NULL,NULL,NULL,
NULL,l_segment1,p_segment2,p_segment3,p_segment4,p_segment5,p_segment6,p_segment7,p_segment8,p_segment9,p_segment10,
p_segment11,p_segment12,p_segment13,p_segment14,p_segment15,p_segment16,p_segment17,p_segment18,p_segment19,p_segment20,
'N','Y',l_start_date_active,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,
SYSDATE,0,SYSDATE,0);
SELECT il.*, l.delete_mark
FROM mtl_item_locations il, ic_loct_mst l
WHERE l.location <> V_location
AND l.whse_code = P_subinventory_code
AND l.inventory_location_id = il.inventory_location_id;
IF l_rec.delete_mark = 0 THEN
l_disable_date := NULL; --SYSDATE; Bug# 5451429 delete mark = 0 is not disabled.
l_disable_date := SYSDATE; --NULL; Bug# 5451429 delete mark <> 0 is disabled.
UPDATE ic_loct_mst
SET locator_id = l_location_id
WHERE location = l_rec.segment1
AND whse_code = p_subinventory_code;
SELECT *
FROM ic_whse_mst_vw
WHERE subinventory_ind_flag = 'Y'
AND orgn_code = P_orgn_code
AND NVL(migrated_ind,0) = 0;
SELECT organization_id
FROM sy_orgn_mst
WHERE orgn_code = V_orgn_code;
SELECT 1
FROM dual
WHERE EXISTS (SELECT 1
FROM mtl_secondary_inventories
WHERE secondary_inventory_name = V_whse_code
AND organization_id = V_organization_id);
SELECT *
FROM mtl_parameters
WHERE organization_id = V_orgn_id;
UPDATE mtl_secondary_inventories
SET locator_type = l_locator_type,
default_loc_status_id = 1
WHERE organization_id = l_organization_id
AND secondary_inventory_name = l_rec.whse_code;
UPDATE ic_loct_mst
SET locator_id = inventory_location_id
WHERE whse_code = l_rec.whse_code;
--Now insert the warehouse into mtl_secondary_inventories table
mtl_secondary_inventories_pkg.insert_row (
x_rowid => l_rowid
, x_secondary_inventory_name => l_rec.whse_code
, x_organization_id => l_organization_id
, x_last_update_date => SYSDATE
, x_last_updated_by => 0
, x_creation_date => SYSDATE
, x_created_by => 0
, x_last_update_login => 0
, x_description => l_rec.whse_name
, x_disable_date => NULL
, x_inventory_atp_code => 1
, x_availability_type => 1
, x_reservable_type => 1
, x_locator_type => l_locator_type
, x_picking_order => NULL
, x_dropping_order => NULL
, x_material_account => l_details.material_account
, x_material_overhead_account => l_details.material_overhead_account
, x_resource_account => l_details.resource_account
, x_overhead_account => l_details.overhead_account
, x_outside_processing_account => l_details.outside_processing_account
, x_quantity_tracked => 1
, x_asset_inventory => 1
, x_source_type => NULL
, x_source_subinventory => NULL
, x_source_organization_id => NULL
, x_requisition_approval_type => NULL
, x_expense_account => l_details.expense_account
, x_encumbrance_account => l_details.encumbrance_account
, x_attribute_category => NULL
, x_attribute1 => NULL
, x_attribute2 => NULL
, x_attribute3 => NULL
, x_attribute4 => NULL
, x_attribute5 => NULL
, x_attribute6 => NULL
, x_attribute7 => NULL
, x_attribute8 => NULL
, x_attribute9 => NULL
, x_attribute10 => NULL
, x_attribute11 => NULL
, x_attribute12 => NULL
, x_attribute13 => NULL
, x_attribute14 => NULL
, x_attribute15 => NULL
, x_preprocessing_lead_time => NULL
, x_processing_lead_time => NULL
, x_postprocessing_lead_time => NULL
, x_demand_class => NULL
, x_project_id => NULL
, x_task_id => NULL
, x_subinventory_usage => NULL
, x_notify_list_id => NULL
, x_depreciable_flag => 2
, x_location_id => NULL
, x_status_id => 1
, x_default_loc_status_id => 1
, x_lpn_controlled_flag => 0
, x_default_cost_group_id => l_details.default_cost_group_id
, x_pick_uom_code => NULL
, x_cartonization_flag => 0
, x_planning_level => 2
, x_default_count_type_code => 2
, x_subinventory_type => 1
, x_enable_bulk_pick => 'N');
UPDATE hr_organization_units
SET date_to = SYSDATE
WHERE organization_id = l_rec.mtl_organization_id;
UPDATE ic_whse_mst
SET organization_id = l_organization_id,
migrated_ind = 1
WHERE whse_code = l_rec.whse_code;
p_delete_mark IN NUMBER,
P_migration_run_id IN NUMBER,
X_failure_count OUT NOCOPY NUMBER,
X_organization_id OUT NOCOPY NUMBER) IS
--CURSORS
CURSOR Cur_get_organization_id (V_orgn_code VARCHAR2)IS
SELECT m.organization_id
FROM mtl_parameters m, ic_whse_mst w
WHERE w.orgn_code = V_orgn_code
AND w.mtl_organization_id = m.organization_id
ORDER BY whse_code;
SELECT *
FROM sy_addr_mst
WHERE addr_id = V_addr_id
AND delete_mark = 0;
SELECT HOU.BUSINESS_GROUP_ID,
DECODE(HOI2.ORG_INFORMATION_CONTEXT, 'Accounting Information', TO_NUMBER(HOI2.ORG_INFORMATION1), TO_NUMBER(NULL)) SET_OF_BOOKS_ID,
DECODE(HOI2.ORG_INFORMATION_CONTEXT, 'Accounting Information', TO_NUMBER(HOI2.ORG_INFORMATION3), TO_NUMBER(NULL)) OPERATING_UNIT,
DECODE(HOI2.ORG_INFORMATION_CONTEXT, 'Accounting Information', TO_NUMBER(HOI2.ORG_INFORMATION2), null) LEGAL_ENTITY
FROM HR_ORGANIZATION_UNITS HOU, HR_ORGANIZATION_INFORMATION HOI2
WHERE HOU.organization_id = V_orgn_id
AND HOU.ORGANIZATION_ID = HOI2.ORGANIZATION_ID
AND ( HOI2.ORG_INFORMATION_CONTEXT || '') ='Accounting Information';
SELECT hr_organization_units_s.nextval
FROM dual;
(SELECT substrb(v_org_code,1,v_start_ch)|| substrb(ltrim(to_char(to_number(rownum)-1,'099')), v_start_ch+1)
FROM gl_sevt_ttl t1, gl_sevt_ttl t2
WHERE rownum <= decode(v_start_ch, 0, 1000, 1, 100, 10)
minus
SELECT organization_code
FROM mtl_parameters);
SELECT *
FROM mtl_parameters
WHERE organization_id = V_orgn_id;
IF (p_migrate_as_ind = 3 OR (p_migrate_as_ind IS NULL AND p_delete_mark = 1)) THEN
l_date_to := SYSDATE;
hr_organization_units_pkg.insert_row(
X_rowid =>l_rowid,
X_organization_id =>X_organization_id,
X_business_group_id =>NVL(l_orgn_def.business_group_id, l_def_business_group),
X_cost_allocation_keyflex_id =>NULL,
X_location_id =>l_location_id,
X_soft_coding_keyflex_id =>NULL,
X_date_from =>p_creation_date,
X_name =>l_organization_name,
X_comments =>NULL,
X_date_to =>l_date_to,
X_internal_external_flag =>'INT',
X_internal_address_line =>NULL,
X_type =>NULL,
X_security_profile_id =>NULL,
X_view_all_orgs =>NULL,
X_attribute_category =>NULL,
X_attribute1 =>NULL,
X_attribute2 =>NULL,
X_attribute3 =>NULL,
X_attribute4 =>NULL,
X_attribute5 =>NULL,
X_attribute6 =>NULL,
X_attribute7 =>NULL,
X_attribute8 =>NULL,
X_attribute9 =>NULL,
X_attribute10 =>NULL,
X_attribute11 =>NULL,
X_attribute12 =>NULL,
X_attribute13 =>NULL,
X_attribute14 =>NULL,
X_attribute15 =>NULL,
X_attribute16 =>NULL,
X_attribute17 =>NULL,
X_attribute18 =>NULL,
X_attribute19 =>NULL,
X_attribute20 =>NULL);
INSERT INTO hr_organization_information(
ORG_INFORMATION_ID,
ORG_INFORMATION_CONTEXT,
ORGANIZATION_ID,
ORG_INFORMATION1,
ORG_INFORMATION2,
ORG_INFORMATION3,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATED_BY,
CREATION_DATE)
VALUES (
hr_organization_information_s.nextval,
'CLASS',
X_organization_id,
'INV',
'Y',
NULL,
sysdate,
0,
0,
sysdate);
INSERT INTO hr_organization_information(
ORG_INFORMATION_ID,
ORG_INFORMATION_CONTEXT,
ORGANIZATION_ID,
ORG_INFORMATION1,
ORG_INFORMATION2,
ORG_INFORMATION3,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATED_BY,
CREATION_DATE)
VALUES (
hr_organization_information_s.nextval,
'Accounting Information',
X_organization_id,
l_orgn_def.set_of_books_id,
l_orgn_def.legal_entity,
l_orgn_def.operating_unit,
sysdate,
0,
0,
sysdate);
INSERT INTO mtl_parameters(
organization_id, last_update_date, last_updated_by, creation_date, created_by, last_update_login,
organization_code, master_organization_id, primary_cost_method, cost_organization_id,
default_material_cost_id, calendar_exception_set_id, calendar_code, general_ledger_update_code,
default_atp_rule_id, default_picking_rule_id, default_locator_order_value, default_subinv_order_value,
negative_inv_receipt_code, stock_locator_control_code, material_account, material_overhead_account,
matl_ovhd_absorption_acct, resource_account, purchase_price_var_account, ap_accrual_account,
overhead_account, outside_processing_account, intransit_inv_account, interorg_receivables_account,
interorg_price_var_account, interorg_payables_account, cost_of_sales_account, encumbrance_account,
interorg_transfer_cr_account, matl_interorg_transfer_code, interorg_trnsfr_charge_percent,
source_organization_id, source_subinventory, source_type, serial_number_type,
auto_serial_alpha_prefix, start_auto_serial_number, auto_lot_alpha_prefix, lot_number_uniqueness,
lot_number_generation, lot_number_zero_padding, lot_number_length, starting_revision,
default_demand_class, encumbrance_reversal_flag, maintain_fifo_qty_stack_type,
invoice_price_var_account, average_cost_var_account, sales_account, expense_account,
serial_number_generation, mat_ovhd_cost_type_id, project_reference_enabled,
pm_cost_collection_enabled, project_control_level, avg_rates_cost_type_id, txn_approval_timeout_period,
borrpay_matl_var_account, borrpay_moh_var_account, borrpay_res_var_account, borrpay_osp_var_account,
borrpay_ovh_var_account, org_max_weight, org_max_volume, org_max_weight_uom_code, org_max_volume_uom_code,
mo_source_required, mo_pick_confirm_required, mo_approval_timeout_action, project_cost_account,
process_enabled_flag, process_orgn_code, wsm_enabled_flag, default_cost_group_id, wms_enabled_flag, qa_skipping_insp_flag,default_status_id)
VALUES (
X_organization_id, l_parameter.last_update_date, l_parameter.last_updated_by, l_parameter.creation_date,
l_parameter.created_by, l_parameter.last_update_login,l_orgn_code, l_master_organization_id, 1,
X_organization_id, l_parameter.default_material_cost_id, l_parameter.calendar_exception_set_id,
l_parameter.calendar_code, l_parameter.general_ledger_update_code, l_parameter.default_atp_rule_id,
l_parameter.default_picking_rule_id, l_parameter.default_locator_order_value, l_parameter.default_subinv_order_value,
l_parameter.negative_inv_receipt_code, 4, l_parameter.material_account,
l_parameter.material_overhead_account, l_parameter.matl_ovhd_absorption_acct, l_parameter.resource_account,
l_parameter.purchase_price_var_account, l_parameter.ap_accrual_account, l_parameter.overhead_account,
l_parameter.outside_processing_account, l_parameter.intransit_inv_account, l_parameter.interorg_receivables_account,
l_parameter.interorg_price_var_account, l_parameter.interorg_payables_account, l_parameter.cost_of_sales_account,
l_parameter.encumbrance_account, l_parameter.interorg_transfer_cr_account, l_parameter.matl_interorg_transfer_code,
l_parameter.interorg_trnsfr_charge_percent, l_parameter.source_organization_id, l_parameter.source_subinventory,
l_parameter.source_type, l_parameter.serial_number_type, l_parameter.auto_serial_alpha_prefix, l_parameter.start_auto_serial_number,
l_parameter.auto_lot_alpha_prefix, 2, l_parameter.lot_number_generation, l_parameter.lot_number_zero_padding,
l_parameter.lot_number_length, l_parameter.starting_revision, l_parameter.default_demand_class, l_parameter.encumbrance_reversal_flag,
l_parameter.maintain_fifo_qty_stack_type, l_parameter.invoice_price_var_account, l_parameter.average_cost_var_account, l_parameter.sales_account,
l_parameter.expense_account, l_parameter.serial_number_generation, l_parameter.mat_ovhd_cost_type_id, l_parameter.project_reference_enabled,
l_parameter.pm_cost_collection_enabled, l_parameter.project_control_level, l_parameter.avg_rates_cost_type_id, l_parameter.txn_approval_timeout_period,
l_parameter.borrpay_matl_var_account, l_parameter.borrpay_moh_var_account, l_parameter.borrpay_res_var_account, l_parameter.borrpay_osp_var_account,
l_parameter.borrpay_ovh_var_account, l_parameter.org_max_weight, l_parameter.org_max_volume, l_parameter.org_max_weight_uom_code,
l_parameter.org_max_volume_uom_code, l_parameter.mo_source_required, l_parameter.mo_pick_confirm_required, l_parameter.mo_approval_timeout_action,
l_parameter.project_cost_account,l_process_enabled_ind, l_parameter.organization_code, l_parameter.wsm_enabled_flag,
l_cost_group_id, l_parameter.wms_enabled_flag, l_parameter.qa_skipping_insp_flag,p_default_status_id);
mtl_secondary_inventories_pkg.insert_row (
x_rowid => l_rowid
, x_secondary_inventory_name => l_orgn_code
, x_organization_id => X_organization_id
, x_last_update_date => SYSDATE
, x_last_updated_by => 0
, x_creation_date => SYSDATE
, x_created_by => 0
, x_last_update_login => 0
, x_description => l_organization_name
, x_disable_date => NULL
, x_inventory_atp_code => 1
, x_availability_type => 1
, x_reservable_type => 1
, x_locator_type => 5
, x_picking_order => NULL
, x_dropping_order => NULL
, x_material_account => l_parameter.material_account
, x_material_overhead_account => l_parameter.material_overhead_account
, x_resource_account => l_parameter.resource_account
, x_overhead_account => l_parameter.overhead_account
, x_outside_processing_account => l_parameter.outside_processing_account
, x_quantity_tracked => 1
, x_asset_inventory => 1
, x_source_type => NULL
, x_source_subinventory => NULL
, x_source_organization_id => NULL
, x_requisition_approval_type => NULL
, x_expense_account => l_parameter.expense_account
, x_encumbrance_account => l_parameter.encumbrance_account
, x_attribute_category => NULL
, x_attribute1 => NULL
, x_attribute2 => NULL
, x_attribute3 => NULL
, x_attribute4 => NULL
, x_attribute5 => NULL
, x_attribute6 => NULL
, x_attribute7 => NULL
, x_attribute8 => NULL
, x_attribute9 => NULL
, x_attribute10 => NULL
, x_attribute11 => NULL
, x_attribute12 => NULL
, x_attribute13 => NULL
, x_attribute14 => NULL
, x_attribute15 => NULL
, x_preprocessing_lead_time => NULL
, x_processing_lead_time => NULL
, x_postprocessing_lead_time => NULL
, x_demand_class => NULL
, x_project_id => NULL
, x_task_id => NULL
, x_subinventory_usage => NULL
, x_notify_list_id => NULL
, x_depreciable_flag => 2
, x_location_id => NULL
, x_status_id => 1
, x_default_loc_status_id => 1
, x_lpn_controlled_flag => 0
, x_default_cost_group_id => l_cost_group_id
, x_pick_uom_code => NULL
, x_cartonization_flag => 0
, x_planning_level => 2
, x_default_count_type_code => 2
, x_subinventory_type => 1
, x_enable_bulk_pick => 'N');
UPDATE hr_locations_all
SET inventory_organization_id = X_organization_id
WHERE location_code = p_orgn_code;
SELECT *
FROM sy_orgn_mst
WHERE (migrate_as_ind <> 0 OR migrate_as_ind IS NULL)
AND (orgn_code <> co_code or plant_ind > 0)
AND NVL(migrated_ind,0) = 0;
SELECT status_id
FROM mtl_material_statuses
WHERE status_code = v_status;
,P_delete_mark => l_rec.delete_mark
,P_migration_run_id => p_migration_run_id
,X_organization_id => l_organization_id
,X_failure_count => l_failure_count);
UPDATE mtl_parameters
SET default_status_id = l_default_status_id
WHERE organization_id = l_rec.organization_id;
UPDATE sy_orgn_mst_b
SET organization_id = l_organization_id,
migrated_ind = 1
WHERE orgn_code = l_rec.orgn_code;