The following lines contain the word 'select', 'insert', 'update' or 'delete':
Select inventory_item_id, tracking_quantity_ind
From mtl_system_items_kfv
Where concatenated_segments = p_item_no
and organization_id = g_organization_id;
Select wip_entity_id
, entity_type
From wip_entities
Where organization_id = g_organization_id
and wip_entity_name= p_wip_entity_name
;
l_main_query := ' Select gen_object_id object_id'
||' , 1 object_type'
||' , lot_number lot_number'
||' From mtl_lot_numbers'
||' Where inventory_item_id = '||g_inventory_item_id
||' and organization_id = '||g_organization_id
||' and lot_number not in (Select lot_number '
||' from mtl_serial_numbers'
||' where lot_number is not null) '
||' Union all'
||' Select gen_object_id object_id'
||' , 5 object_type'
||' , lot_number lot_number'
||' From mtl_serial_numbers'
||' Where inventory_item_id = '||g_inventory_item_id
;
l_main_query := ' Select gen_object_id object_id'
||' , 2 object_type'
||' , lot_number lot_number'
||' From mtl_serial_numbers'
||' Where inventory_item_id =' || g_inventory_item_id
||' and serial_number = '||''''||p_serial_number||''''
||' and decode(lot_number, null, '||''''||'%%%%%'||''''||', lot_number) '
||' = decode('||''''||p_lot_number||''''||', null, '||''''||'%%%%%'||''''||','||''''||p_lot_number||''''||')'
;
l_main_query := ' Select gen_object_id object_id'
||' , 2 object_type'
||' , lot_number lot_number'
||' From mtl_serial_numbers'
||' Where inventory_item_id = '||g_inventory_item_id
||' and lot_number = '||''''||p_lot_number||''''
||' Union all '
||' Select gen_object_id object_id'
||' , 1 object_type'
||' , lot_number lot_number'
||' From mtl_lot_numbers'
||' Where inventory_item_id = '||g_inventory_item_id
||' and organization_id = '||g_organization_id
||' and lot_number = '||''''||p_lot_number||''''
||' and lot_number not in (Select lot_number'
||' From mtl_serial_numbers'
||' Where lot_number is not null )'
;
l_main_query := ' Select gen_object_id object_id'
||' , 5 object_type'
||' , null lot_number'
||' From wip_entities'
||' Where primary_item_id = '||g_inventory_item_id
||' and organization_id = '||g_organization_id
||' and wip_entity_name = '||''''||p_wip_entity_name||''''
;
/*l_main_query := ' Select gen_object_id object_id'
||' , 5 object_type'
||' From wsm_discrete_jobs_lotattr_v'
||' Where primary_item_id = '||g_inventory_item_id
||' and organization_id = '||g_organization_id
||' and wip_entity_name = '||p_wip_entity_name
||' Union All'
||' Select gen_object_id object_id'
||' , 5 object_type'
||' From mtl_mfg_genealogy_lotattr_v'
||' Where primary_item_id = '||g_inventory_item_id
||' and organization_id = '||g_organization_id
||' and wip_entity_name = '||p_wip_entity_name
||' Union All'
;
l_main_query := ' Select we.gen_object_id object_id'
||' , 5 object_type'
||' , mln.lot_number lot_number'
||' From wip_entities we'
||' , mtl_lot_numbers mln'
||' Where we.primary_item_id = '||g_inventory_item_id
||' and we.organization_id = '||g_organization_id
||' and we.organization_id = mln.organization_id'
||' and mln.inventory_item_id = we.primary_item_id'
||' and mln.lot_number = '||''''||p_lot_number||''''
||' and we.wip_entity_name = '||''''||p_wip_entity_name||''''
;
l_main_query := ' Select we.gen_object_id object_id'
||' , 5 object_type'
||' , lot_number lot_number'
||' From mtl_serial_numbers msn '
||' , wip_entities we '
||' Where msn.serial_number = '||''''|| p_serial_number||''''
||' and we.wip_entity_name = '||''''||p_wip_entity_name||''''
--||' and we.wip_entity_id = msn.wip_entity_id '
||' and we.primary_item_id = msn.inventory_item_id '
;
l_main_query := ' Select we.gen_object_id object_id'
||' , 5 object_type'
||' , lot_number lot_number'
||' From mtl_serial_numbers msn '
||' , wip_entities we '
||' Where msn.serial_number = '||''''|| p_serial_number||''''
||' and we.wip_entity_name = '||''''||p_wip_entity_name||''''
||' and msn.lot_number = '||''''||p_lot_number||''''
||' and we.primary_item_id = msn.inventory_item_id '
;
Select gen_object_id
, 1
Into l_object_id2
, l_object_type2
From mtl_lot_numbers
Where lot_number = l_current_lot_number
and organization_id = g_organization_id
and inventory_item_id = g_inventory_item_id;
SELECT mp.organization_id
, hou.NAME
FROM mtl_parameters mp
, hr_organization_units hou
WHERE mp.organization_code = p_organization_code
AND hou.organization_id = mp.organization_id;
Select meaning
From mfg_lookups
where lookup_type='INV_REPORT_GENEALOGY_TYPE'
and lookup_code = g_genealogy_type;
SELECT wip_entity_name
, entity_type
, organization_id
, wip_entity_id
, primary_item_id
FROM wip_entities
WHERE gen_object_id = l_object_id
;
Select 1
From gme_batch_header_vw
Where batch_id = l_wip_entity_id;
SELECT mp.organization_code
, hou.NAME
, mln.organization_id
INTO l_current_org_code
, l_current_org_desc
, l_current_org_id
FROM mtl_parameters mp
, hr_organization_units hou
, mtl_lot_numbers mln
WHERE mln.gen_object_id = l_object_id
AND mp.organization_id = mln.organization_id
AND hou.organization_id = mln.organization_id;
SELECT mp.organization_code
, hou.NAME
, msn.current_organization_id
INTO l_current_org_code
, l_current_org_desc
, l_current_org_id
FROM mtl_parameters mp
, hr_organization_units hou
, mtl_serial_numbers msn
WHERE msn.gen_object_id = l_object_id
AND mp.organization_id = msn.current_organization_id
AND hou.organization_id = msn.current_organization_id;
SELECT wip_entity_name
, entity_type
, organization_id
, wip_entity_id
, primary_item_id
INTO l_wip_entity_name
, l_wip_entity_type
, l_current_org_id
, l_wip_entity_id
, l_inventory_item_id
FROM wip_entities
WHERE wip_entity_id = l_object_id;
Select shelf_life_days
, concatenated_segments
, description
, retest_interval
, DECODE(tracking_quantity_ind,'PS',secondary_uom_code) secondary_uom_code --Bug#5436402
from mtl_system_items_kfv
where inventory_item_id= p_item_info_rec.inventory_item_id
and organization_id = g_organization_id;
select parent_lot_number
, grade_code
, retest_date
, expiration_date
, hold_date
, vendor_name
, origination_date
, sampling_event_id
From mtl_lot_numbers
where lot_number = p_lot_attributes_rec.lot_number
and organization_id = p_lot_attributes_rec.organization_id
and inventory_item_id = p_lot_attributes_rec.inventory_item_id;
Select origin_txn_id
From mtl_object_genealogy
Where object_id = p_lot_attributes_rec.object_id;
Select transaction_source_name
,transaction_quantity
,transaction_uom
,receiving_document
,transaction_action_id
,transaction_date
From mtl_material_transactions
Where transaction_id = l_orig_txn_id;
Select meaning
From mfg_lookups
Where lookup_type = 'MTL_TRANSACTION_ACTION'
and lookup_code = l_txn_action_id;
Select transaction_id
, transaction_source_name
, transaction_source
, transaction_date
, transaction_uom
, transaction_quantity
, transaction_type_id
, trading_partner
From mtl_transaction_details_v
Where object_id = p_lot_attributes_rec.object_id
Order by transaction_date asc;
Select mtt.transaction_type_name
From mtl_transaction_types mtt
Where mtt.transaction_type_id = l_txn_type_id;
select current_status_name
, completion_date
, ship_date
, original_wip_entity_id
, inventory_item_id
, operation_seq_num
, intraoperation_step_type
, lot_number
from mtl_serial_numbers_all_v
where serial_number = p_serial_attributes_rec.serial_number
and gen_object_id = p_serial_attributes_rec.object_id;
select we.wip_entity_name
from wip_entities we
where we.wip_entity_id = p_serial_attributes_rec.wip_entity_id
;
SELECT meaning
FROM mfg_lookups
WHERE lookup_type = 'WIP_INTRAOPERATION_STEP'
and lookup_code = p_serial_attributes_rec.intraoperation_step_type;
l_select VARCHAR2(1000);
Select item_number
, item_description
, batch_status
, status_type
, organization_code
, organization_name
, work_order_type
, wip_entity_name
, date_released
, date_completed
from mtl_work_order_header_v
where wip_entity_id = p_work_order_header_rec.wip_entity_id
;
select item_number
, item_description
, start_quantity
, quantity_remaining
, quantity_scrapped
, quantity_completed
, uom
from wsm_wip_genealogy_lotattr_v
where wip_entity_id = p_work_order_header_rec.wip_entity_id
;
select item_number
, item_description
, start_quantity
, quantity_remaining
, quantity_scrapped
, quantity_completed
, uom
from mtl_mfg_genealogy_lotattr_v
where wip_entity_id = p_work_order_header_rec.wip_entity_id
;
l_select := 'select item_number'
||' , item_description'
||' , start_quantity'
||' , quantity_remaining'
||' , quantity_scrapped'
||' , quantity_completed'
||' , uom'
;
l_query := l_select||l_from||l_where;
l_select VARCHAR2(1000);
select
transaction_date
, organization_code
, transaction_source_name
, transaction_type_id
, transaction_source -- document?
, transaction_quantity
, transaction_uom
, secondary_quantity
, subinventory_code
, locator_id
, source_line_id
, project
, task
, lpn_number
, transfer_lpn_number
, content_lpn_number
from mtl_transaction_details_v
where object_id = p_material_txn_rec.object_id
and object_type = p_material_txn_rec.object_type
and organization_id = p_material_txn_rec.current_org_id
;
select
transaction_date
, organization_code
, transaction_source_name
, transaction_type_id
, source_code -- document?
, transaction_quantity
, transaction_uom
, secondary_quantity
, subinventory_code
, locator_id
, source_line_id
, project
, task
, lpn_number
, transfer_lpn_number
, content_lpn_number
from wsm_inv_txns_wip_lots_v
where object_id = p_material_txn_rec.object_id
and object_type = p_material_txn_rec.object_type
and organization_id = p_material_txn_rec.current_org_id
;
select
transaction_date
, organization_code
, transaction_source_name
, transaction_type_id
, source_code -- document?
, transaction_quantity
, transaction_uom
, secondary_quantity
, subinventory_code
, locator_id
, source_line_id
, project
, task
, lpn_number
, transfer_lpn_number
, content_lpn_number
from mtl_inv_txns_mfg_lots_v
where object_id = p_material_txn_rec.object_id
and object_type = p_material_txn_rec.object_type
and organization_id = p_material_txn_rec.current_org_id
;
l_select := 'select'
||' transaction_date'
||' , organization_code'
||' , transaction_source_name'
||' , transaction_source'
||' , transaction_type_id'
||' , source_code'
||' , transaction_quantity'
||' , transaction_uom'
||' , secondary_quantity'
||' , subinventory_code'
||' , locator_id'
||' , source_line_id'
||' , project'
||' , task'
||' , lpn_number'
||' , transfer_lpn_number'
||' , content_lpn_number'
--Bug#5436511 Added grade_code column to the select statement.
||' , grade_code'
;
l_query := l_select||l_from||l_where||l_order_by;
SELECT ml.meaning
into p_material_txn_rec.TRANSACTION_TYPE
from wsm_lot_split_merges wlsm
, mfg_lookups ml
where wlsm.transaction_id= l_source_line_id
and ml.lookup_type='WSM_INV_LOT_TXN_TYPE'
and ml.lookup_code=wlsm.transaction_type_id;
select mtt.transaction_type_name
into p_material_txn_rec.transaction_type
from MTL_TRANSACTION_TYPES mtt
where mtt.transaction_type_id = l_transaction_type_id;
l_select VARCHAR2(1000);
select
transaction_date
, organization_code
, transaction_source_name
, transaction_type_id
, source_code -- document?
, transaction_quantity
, transaction_uom
, secondary_quantity
, subinventory_code
, locator_id
, source_line_id
, project
, task
, lpn_number
, transfer_lpn_number
, content_lpn_number
, transaction_status
from mtl_pending_txn_details_v
where object_id = p_pending_txn_rec.object_id
and object_type = p_pending_txn_rec.object_type
and organization_id = p_pending_txn_rec.current_org_id
;
select
transaction_date
, organization_code
, transaction_source_name
, transaction_type_id
, source_code -- document?
, transaction_quantity
, transaction_uom
, secondary_quantity
, subinventory_code
, locator_id
, source_line_id
, project
, task
, lpn_number
, transfer_lpn_number
, content_lpn_number
, transaction_status
from mtl_pending_txns_mfg_lots_v
where object_id = p_pending_txn_rec.object_id
and object_type = p_pending_txn_rec.object_type
and organization_id = p_pending_txn_rec.current_org_id
;
l_select := 'select transaction_date '
||' , organization_code'
||' , transaction_source_name'
||' , transaction_type_id'
||' , source_code'
||' , transaction_quantity'
||' , transaction_uom'
||' , secondary_quantity'
||' , subinventory_code'
||' , locator_id'
||' , source_line_id'
||' , project'
||' , task'
||' , lpn_number'
||' , transfer_lpn_number'
||' , content_lpn_number'
||' , transaction_status'
;
l_query := l_select||l_from||l_where||l_order_by;
SELECT ml.meaning
into p_pending_txn_rec.TRANSACTION_TYPE
from wsm_lot_split_merges wlsm
, mfg_lookups ml
where wlsm.transaction_id= l_source_line_id
and ml.lookup_type='WSM_INV_LOT_TXN_TYPE'
and ml.lookup_code=wlsm.transaction_type_id;
select mtt.transaction_type_name
into p_pending_txn_rec.transaction_type
from MTL_TRANSACTION_TYPES mtt
where mtt.transaction_type_id = l_transaction_type_id;
l_select VARCHAR2(1000);
select organization_code
, transaction_date
, item_number
, item_type
, lot_number
, primary_quantity
, primary_uom_code
, secondary_quantity
, secondary_uom_code
, subinventory_code
, locator_id
, grade_code
, serial_number
from mtl_mfg_products_v
where comp_item_id = p_product_rec.inventory_item_id
and organization_id = p_product_rec.current_org_id
;
/*Bug#5436402 The selection from view mtl_mfg_products_v fetches secondary uom irrespeive of tracking id.
if the item is not tracked in Primary and Secondary then we should not display sec qty and sec uom*/
IF g_tracking_quantity_ind <> 'PS' THEN
p_product_rec.secondary_quantity := NULL;
select organization_code
, transaction_date
, item_number
, lot_number
, primary_quantity
, primary_uom_code
, secondary_quantity
, secondary_uom_code
, subinventory_code
, locator_id
, grade_code
, serial_number
, wip_entity_name
from mtl_mfg_components_v
where product_item_id = p_component_rec.inventory_item_id
AND DECODE(product_lot_number,NULL, '%%$#', product_lot_number)
= DECODE( p_component_rec.product_lot_number, NULL, '%%$#', p_component_rec.product_lot_number)
AND DECODE(product_serial_number, NULL, '%%##', product_serial_number)
= DECODE(p_component_rec.product_serial_number, NULL, '%%##', p_component_rec.product_serial_number)
ORDER BY transaction_date DESC
;
/*Bug#5436402 The selection from view mtl_mfg_components_v fetches secondary uom irrespeive of tracking ind.
if the item is not tracked in Primary and Secondary then we should not display sec qty and sec uom*/
IF g_tracking_quantity_ind <> 'PS' THEN
p_component_rec.secondary_quantity := NULL;
Select name
, description
, plan_type_description
from mtl_genealogy_qa_data
where (item_id = p_quality_collections_rec.inventory_item_id)
or comp_item_id = p_quality_collections_rec.inventory_item_id))
and lot_number = decode(p_quality_collections_rec.lot_number, null,'%%XX', p_quality_collections_rec.lot_number)
or comp_lot_number = decode(p_quality_collections_rec.lot_number, null,'%%XX', p_quality_collections_rec.lot_number))
and serial_number = decode(p_quality_collections_rec.serial_number, null,'%%XX', p_quality_collections_rec.serial_number)
or comp_serial_number = decode(p_quality_collections_rec.serial_number, null,'%%XX', p_quality_collections_rec.serial_number))
and decode(wip_entity_id, null,'%%XX', wip_entity_id)
= decode(p_quality_collections_rec.wip_entity_id, null,'%%XX', p_quality_collections_rec.wip_entity_id)
;
l_query := ' Select name '
|| ', description'
|| ', plan_type_description'
|| ' from mtl_genealogy_qa_data '
;
l_select VARCHAR2(1000);
select sample_no
, sample_desc
, date_drawn
, source
, lot_number
, subinventory
, sample_qty
, sample_qty_uom
, locator_id
from gmd_samples
where inventory_item_id = p_quality_samples_rec.inventory_item_id
and organization_id = p_quality_samples_rec.current_org_id
and decode(lot_number,'%%XX', lot_number) = decode(p_quality_samples_rec.lot, '%%XX', p_quality_samples_rec.lot)
;
select count(*)
from gmd_samples
where inventory_item_id = p_quality_samples_rec.inventory_item_id
and organization_id = p_quality_samples_rec.current_org_id
and decode(lot_number,'%%XX', lot_number) = decode(p_quality_samples_rec.lot, '%%XX', p_quality_samples_rec.lot)
;
SELECT mp.organization_code
FROM mtl_parameters mp
WHERE mp.organization_id = p_quality_samples_rec.current_org_id
;
select sample_no
, sample_desc
, date_drawn
, source
, lot_number
, subinventory
, sample_qty
, sample_qty_uom
, locator_id
from gmd_samples
where inventory_item_id = p_quality_samples_rec.inventory_item_id
and organization_id = p_quality_samples_rec.current_org_id
and decode(lot_number,'%%XX', lot_number) = decode(p_quality_samples_rec.parent_lot, '%%XX', p_quality_samples_rec.parent_lot)
;
select count(*)
from gmd_samples
where inventory_item_id = p_quality_samples_rec.inventory_item_id
and organization_id = p_quality_samples_rec.current_org_id
and decode(lot_number,'%%XX', lot_number) = decode(p_quality_samples_rec.parent_lot, '%%XX', p_quality_samples_rec.parent_lot)
;
select sample_no
, sample_desc
, date_drawn
, source
, lot_number
, subinventory
, sample_qty
, sample_qty_uom
, locator_id
from gmd_samples
where sampling_event_id = p_quality_samples_rec.sampling_event_id
;
l_select := 'select sample_no'
||' , sample_desc'
||' , date_drawn'
||' , source'
||' , lot_number'
||' , subinventory'
||' , sample_qty'
||' , sample_qty_uom'
||' , locator_id'
;
l_query := l_select||l_from||l_where;
select *
from wsm_wip_lot_txns_v
Where object_id = p_lotbased_wip_txn_rec.object_id;
Select concatenated_segments
from mtl_system_items_kfv
Where inventory_item_id = p_item_id
and organization_id = p_organization_id
;
Select user_name
into l_user_name
From fnd_user
Where user_id = p_lotbased_wip_txn_rec.created_by
;
select transaction_date
, wip_entity_name
, fm_operation_seq_num
, fm_operation_code
, fm_department_code
, fm_intraoperation_step_meaning
, to_operation_seq_num
, to_operation_code
, to_department_code
, to_intraoperation_step_meaning
, transaction_uom
, transaction_quantity
, primary_uom
, primary_quantity
, overcompletion_transaction_qty
, overcompletion_primary_qty
from wip_move_transactions_v
Where wip_entity_id = p_move_txn_rec.wip_entity_id
and organization_id = p_move_txn_rec.organization_id;
Select concatenated_segments
from mtl_system_items_kfv
Where inventory_item_id = p_item_id
and organization_id = p_organization_id
;
select date_stamp
, action
, old_value
, new_value
, primary_quantity
, secondary_quantity
, change_reason
, user_id
from mtl_grd_sts_history_v
where inventory_item_id = p_grade_status_rec.inventory_item_id
and organization_id = p_grade_status_rec.current_org_id
and lot_number = p_grade_status_rec.lot_number
;
Select user_name
into p_grade_status_rec.user
From fnd_user
Where user_id = l_user_id;
SELECT object_id
, inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)
FROM mtl_object_genealogy
WHERE parent_object_id = l_object_id
;
SELECT object_id
, object_type
, object_id2
, object_type2
, inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)
FROM mtl_object_genealogy
WHERE (end_date_active IS NULL OR end_date_active >= SYSDATE)
CONNECT BY PRIOR object_id = parent_object_id
START WITH (parent_object_id2 IS NULL OR parent_object_id2 = l_object_id2)
AND parent_object_id = l_object_id
;
Select 1
From wip_entities wip
, gme_batch_header_vw gme
Where wip.gen_object_id = p_object_id
and wip.entity_type in (9, 10)
and wip.wip_entity_id = gme.batch_id
;
l_query := ' SELECT object_id '
||' , object_type'
||' , object_id2'
||' , object_type2'
||' , inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)'
||' FROM mtl_object_genealogy'
||' WHERE (end_date_active IS NULL OR end_date_active >= SYSDATE)'
||' and decode(parent_object_id2,null, -9999, parent_object_id2) = '||l_fake_object_id2
||' AND parent_object_id = '||l_object_id
--||' CONNECT BY PRIOR object_id = parent_object_id'
--||' START WITH decode(parent_object_id2,null, -9999, parent_object_id2) = '||l_fake_object_id2
--||' AND parent_object_id = '||l_object_id
;
l_query := 'SELECT object_id '
||' , object_type '
||' , object_id2 '
||' , object_type2 '
||' , inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)'
||' FROM mtl_object_genealogy '
||' WHERE parent_object_id = '||l_object_id
||' AND(end_date_active IS NULL '
||' OR TRUNC(end_date_active) >= TRUNC(SYSDATE)) '
;
SELECT object_id
, object_type
, object_id2
, object_type2
, inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)
FROM mtl_object_genealogy
WHERE parent_object_id = l_object_id
;
Select 1
From wip_entities wip
, gme_batch_header_vw gme
Where wip.gen_object_id = p_object_id
and wip.entity_type in (9, 10)
and wip.wip_entity_id = gme.batch_id
;
l_query := ' SELECT object_id '
||' , object_type'
||' , object_id2'
||' , object_type2'
||' , inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)'
||' FROM mtl_object_genealogy'
||' WHERE (end_date_active IS NULL OR end_date_active >= SYSDATE)'
||' and decode(parent_object_id2,null, -9999, parent_object_id2) = '||l_fake_object_id2
||' AND parent_object_id = '||l_object_id
--||' CONNECT BY PRIOR object_id = parent_object_id'
--||' START WITH decode(parent_object_id2,null, -9999, parent_object_id2) = '||l_fake_object_id2
--||' AND parent_object_id = '||l_object_id
;
l_query := 'SELECT object_id '
||' , object_type '
||' , object_id2 '
||' , object_type2 '
||' , inv_object_genealogy.getobjectnumber(object_id, object_type, object_id2, object_type2)'
||' FROM mtl_object_genealogy '
||' WHERE parent_object_id = '||l_object_id
||' AND(end_date_active IS NULL '
||' OR TRUNC(end_date_active) >= TRUNC(SYSDATE)) '
;
SELECT parent_object_id
, parent_object_type
, parent_object_id2
, parent_object_type2
, inv_object_genealogy.getobjectnumber(parent_object_id, parent_object_type, parent_object_id2, parent_object_type2)
FROM mtl_object_genealogy
WHERE object_id = l_parent_object_id
;
Select 1
From wip_entities wip
, gme_batch_header_vw gme
Where wip.gen_object_id = l_parent_object_id
and wip.entity_type in (9, 10)
and wip.wip_entity_id = gme.batch_id
;
l_query := ' SELECT parent_object_id '
||' , parent_object_type'
||' , parent_object_id2'
||' , parent_object_type2'
||' , inv_object_genealogy.getobjectnumber(parent_object_id, parent_object_type, parent_object_id2, parent_object_type2)'
||' FROM mtl_object_genealogy'
||' WHERE (end_date_active IS NULL OR end_date_active >= SYSDATE)'
||' and decode(object_id2,null, -9999, object_id2) = '||l_fake_object_id2
||' AND object_id = '||l_parent_object_id
--||' CONNECT BY object_id = PRIOR parent_object_id '
--||' START WITH decode(object_id2,null, -9999, object_id2) = '||l_fake_object_id2
--||' AND object_id = '||l_parent_object_id
;
l_query := ' SELECT parent_object_id '
||' , parent_object_type '
||' , parent_object_id2 '
||' , parent_object_type2 '
||' , inv_object_genealogy.getobjectnumber(parent_object_id, parent_object_type, parent_object_id2, parent_object_type2)'
||' FROM mtl_object_genealogy '
||' WHERE object_id = '||l_parent_object_id
||' AND(end_date_active IS NULL '
||' OR TRUNC(end_date_active) >= TRUNC(SYSDATE)) '
;
Select 1
From wip_entities wip
, gme_batch_header_vw gme
Where wip.gen_object_id = p_object_id
and wip.entity_type in (9, 10)
and wip.wip_entity_id = gme.batch_id
;
l_query := ' SELECT parent_object_id '
||' , parent_object_type'
||' , parent_object_id2'
||' , parent_object_type2'
||' , inv_object_genealogy.getobjectnumber(parent_object_id, parent_object_type, parent_object_id2, parent_object_type2)'
||' FROM mtl_object_genealogy'
||' WHERE (end_date_active IS NULL OR end_date_active >= SYSDATE)'
||' and decode(object_id2,null, -9999, object_id2) = '||l_fake_object_id2
||' AND object_id = '||l_object_id
--||' CONNECT BY object_id = PRIOR parent_object_id '
--||' START WITH decode(object_id2,null, -9999, object_id2) = '||l_fake_object_id2
--||' AND object_id = '||l_object_id
;
l_query := ' SELECT parent_object_id '
||' , parent_object_type '
||' , parent_object_id2 '
||' , parent_object_type2 '
||' , inv_object_genealogy.getobjectnumber(parent_object_id, parent_object_type, parent_object_id2, parent_object_type2)'
||' FROM mtl_object_genealogy '
||' WHERE object_id = '||l_object_id
||' AND(end_date_active IS NULL '
||' OR TRUNC(end_date_active) >= TRUNC(SYSDATE)) '
;
l_query := ' SELECT parent_object_id '
||' , parent_object_type'
||' , parent_object_id2'
||' , parent_object_type2'
||' , inv_object_genealogy.getobjectnumber(parent_object_id, parent_object_type, parent_object_id2, parent_object_type2)'
||' FROM mtl_object_genealogy'
||' WHERE (end_date_active IS NULL OR end_date_active >= SYSDATE)'
||' CONNECT BY object_id = PRIOR parent_object_id '
||' START WITH decode(object_id2,null, -9999, object_id2) = '||l_fake_object_id2
||' AND object_id = '||l_parent_object_id
;