The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT DISTINCT operation_id
FROM AHL_OPERATIONS_B_KFV
WHERE concatenated_segments = c_concatenated_segments;
SELECT DISTINCT operation_id
FROM AHL_OPERATIONS_B
WHERE operation_id = c_operation_id;
SELECT DISTINCT lookup_code
FROM FND_LOOKUP_VALUES_VL
WHERE lookup_type = c_lookup_type
AND meaning = c_lookup_meaning
AND ( (lookup_type <> 'ITEM_TYPE') OR (lookup_type = 'ITEM_TYPE' AND view_application_id in (0,3)))
AND SYSDATE BETWEEN NVL( start_date_active, SYSDATE ) AND
NVL( end_date_active, SYSDATE );
SELECT DISTINCT lookup_code
FROM FND_LOOKUP_VALUES_VL
WHERE lookup_type = c_lookup_type
AND lookup_code = c_lookup_code
AND ( (lookup_type <> 'ITEM_TYPE') OR (lookup_type = 'ITEM_TYPE' AND view_application_id in (0,3)))
AND SYSDATE BETWEEN NVL( start_date_active, SYSDATE ) AND
NVL( end_date_active, SYSDATE );
SELECT DISTINCT party_id
FROM HZ_PARTIES
WHERE party_name = c_operator_name;
SELECT DISTINCT party_id
FROM HZ_PARTIES
WHERE party_id = c_operator_party_id;
SELECT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
mtl.inventory_item_flag
from
AHL_MTL_ITEMS_EAM_V mtl
where
MTL.inventory_item_flag = 'Y'
AND mtl.enabled_flag = 'Y'
and mtl.concatenated_segments like c_item_number
and mtl.organization_id = c_inventory_org_id
order by 1;
SELECT DISTINCT MI.inventory_item_id,
MI.organization_id,
NVL(MI.inventory_item_flag,'X')
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE MP.organization_id = MI.organization_id
AND MI.concatenated_segments = c_item_number
AND MI.organization_id = c_inventory_org_id
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE )
AND DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y';
SELECT DISTINCT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
NVL(mtl.inventory_item_flag,'X')
from
MTL_SYSTEM_ITEMS_KFV MTL
, fnd_lookup_values_vl IT
, MTL_PARAMETERS MP
where
DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',mp.eam_enabled_flag )='Y'
AND MTL.ORGANIZATION_ID = MP.MASTER_ORGANIZATION_ID
and MTL.inventory_item_flag = 'Y'
AND IT.lookup_code (+) = MTL.item_type
AND IT.lookup_type (+) = 'ITEM_TYPE'
AND mtl.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( mtl.start_date_active, SYSDATE )
AND NVL( mtl.end_date_active, SYSDATE )
and upper(mtl.concatenated_segments) like upper(c_item_number)
and mtl.organization_id = c_inventory_org_id
order by 1;
SELECT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
mtl.inventory_item_flag
from AHL_MTL_ITEMS_EAM_V mtl
where
MTL.inventory_item_flag = 'Y'
AND mtl.enabled_flag = 'Y'
and mtl.inventory_item_id = c_inventory_item_id
and mtl.organization_id = c_inventory_org_id
order by 1;
SELECT DISTINCT MI.inventory_item_id,
MI.organization_id,
NVL(MI.inventory_item_flag,'X')
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y'
AND MP.organization_id = MI.organization_id
AND MI.inventory_item_id = c_inventory_item_id
AND MI.organization_id = c_inventory_org_id
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE );
SELECT DISTINCT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
NVL(mtl.inventory_item_flag,'X')
from MTL_SYSTEM_ITEMS_KFV MTL
, MTL_PARAMETERS MP
, fnd_lookup_values_vl IT
where
DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',mp.eam_enabled_flag )='Y'
AND MTL.ORGANIZATION_ID = MP.MASTER_ORGANIZATION_ID
and MTL.inventory_item_flag = 'Y'
AND IT.lookup_code (+) = MTL.item_type
AND IT.lookup_type (+) = 'ITEM_TYPE'
AND mtl.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( mtl.start_date_active, SYSDATE )
AND NVL( mtl.end_date_active, SYSDATE )
and mtl.inventory_item_id = c_inventory_item_id
and mtl.organization_id = c_inventory_org_id
order by 1;
SELECT DISTINCT MTL.inventory_item_id,
MTL.organization_id,
MTL.inventory_item_flag,
MTL.mtl_transactions_enabled_flag,
MTL.stock_enabled_flag
--NVL(MTL.wip_supply_type,0) --pdoki commented for Bug 8589785
FROM AHL_MTL_ITEMS_EAM_V MTL
WHERE
MTL.concatenated_segments = c_item_number
AND MTL.organization_id = c_inventory_org_id
AND MTL.enabled_flag = 'Y';
SELECT DISTINCT MI.inventory_item_id,
-- MI.organization_id,
MP.master_organization_id,
NVL(MI.inventory_item_flag,'X'),
NVL(MI.mtl_transactions_enabled_flag,'X'),
NVL(MI.stock_enabled_flag,'X'),
NVL(MI.wip_supply_type,0)
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y'
AND MP.master_organization_id = MI.organization_id
AND MI.concatenated_segments = c_item_number
--AND MI.organization_id = c_inventory_org_id
AND MP.master_organization_id = c_inventory_org_id
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE );
SELECT DISTINCT
mtl.inventory_item_id ,
mtl.inventory_org_id ,
NVL(mtl.inventory_item_flag,'X'),
NVL(mtl.mtl_transactions_enabled_flag,'X'),
NVL(mtl.stock_enabled_flag,'X'),
NVL(mtl.wip_supply_type,0)
from ahl_mtl_items_non_ou_v mtl
where
DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',mtl.eam_enabled_flag )='Y'
AND mtl.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( mtl.start_date_active, SYSDATE )
AND NVL( mtl.end_date_active, SYSDATE )
and upper(mtl.concatenated_segments) like upper(c_item_number)
and mtl.inventory_org_id = c_inventory_org_id
order by 1;
SELECT DISTINCT MTL.inventory_item_id,
MTL.organization_id,
MTL.inventory_item_flag,
MTL.mtl_transactions_enabled_flag,
MTL.stock_enabled_flag
-- NVL(MTL.wip_supply_type,0) --pdoki commented for Bug 8589785
FROM AHL_MTL_ITEMS_EAM_V MTL
WHERE
MTL.inventory_item_id = c_inventory_item_id
AND MTL.organization_id = c_inventory_org_id
AND MTL.enabled_flag = 'Y';
SELECT DISTINCT MI.inventory_item_id,
-- MI.organization_id,
MP.master_organization_id,
NVL(MI.inventory_item_flag,'X'),
NVL(MI.mtl_transactions_enabled_flag,'X'),
NVL(MI.stock_enabled_flag,'X'),
NVL(MI.wip_supply_type,0)
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y'
AND MP.master_organization_id = MI.organization_id
AND MI.inventory_item_id = c_inventory_item_id
--AND MI.organization_id = c_inventory_org_id
AND MP.master_organization_id = c_inventory_org_id
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE );
SELECT DISTINCT
mtl.inventory_item_id ,
mtl.inventory_org_id ,
NVL(mtl.inventory_item_flag,'X'),
NVL(mtl.mtl_transactions_enabled_flag,'X'),
NVL(mtl.stock_enabled_flag,'X'),
NVL(mtl.wip_supply_type,0)
from ahl_mtl_items_non_ou_v mtl
where
DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',mtl.eam_enabled_flag )='Y'
AND mtl.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( mtl.start_date_active, SYSDATE )
AND NVL( mtl.end_date_active, SYSDATE )
and mtl.inventory_item_id = c_inventory_item_id
and mtl.inventory_org_id = c_inventory_org_id
order by 1;
SELECT DISTINCT MI.inventory_item_id,
mast.organization_id,
MI.outside_operation_flag,
MI.purchasing_item_flag,
MI.purchasing_enabled_flag
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI,mtl_system_items_b mast
WHERE DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y'
AND MP.organization_id = MI.organization_id
AND MP.master_organization_id = mast.organization_id
AND MI.concatenated_segments = c_item_number
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE );
SELECT DISTINCT MI.inventory_item_id,
MI.organization_id,
MI.outside_operation_flag,
MI.purchasing_item_flag,
MI.purchasing_enabled_flag
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y'
AND MP.organization_id = MI.organization_id
AND MI.inventory_item_id = c_inventory_item_id
AND MI.organization_id = c_inventory_org_id
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE );
SELECT
MTL.INVENTORY_ITEM_ID ,
MTL.organization_id ,
MTL.comms_nl_trackable_flag
from AHL_MTL_ITEMS_EAM_V MTL
where
upper(nvl(MTL.comms_nl_trackable_flag,'N')) = 'Y'
and MTL.enabled_flag = 'Y'
and upper(MTL.concatenated_segments) like upper(c_item_number)
and upper(MTL.organization_code) like upper(c_org_code)
order by 1;
SELECT DISTINCT MI.inventory_item_id,
MP.master_organization_id,
MI.comms_nl_trackable_flag
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE MP.master_organization_id = MI.organization_id
AND upper(MI.concatenated_segments) = upper(c_item_number)
AND MI.enabled_flag = 'Y'
AND upper(MP.ORGANIZATION_CODE)=upper(c_org_code)
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE )
AND DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y';
SELECT DISTINCT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
mtl.comms_nl_trackable_flag
from MTL_SYSTEM_ITEMS_KFV MTL
, MTL_PARAMETERS MP
, MTL_PARAMETERS MP1
, fnd_lookup_values_vl IT
where
DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',mp.eam_enabled_flag )='Y'
AND MTL.ORGANIZATION_ID = MP.MASTER_ORGANIZATION_ID
and MP.MASTER_ORGANIZATION_ID = MP1.ORGANIZATION_ID
and sysdate between nvl( MTL.start_date_active, sysdate )
and nvl( MTL.end_date_active, sysdate )
and IT.lookup_code (+) = MTL.item_type
and IT.lookup_type (+) = 'ITEM_TYPE'
and MTL.enabled_flag = 'Y'
and upper(mtl.concatenated_segments) like upper(c_item_number)
and upper(mp1.organization_code) like upper(c_org_code)
order by 1;
SELECT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
mtl.comms_nl_trackable_flag
from AHL_MTL_ITEMS_EAM_V MTL
where
upper(nvl(MTL.comms_nl_trackable_flag,'N')) = 'Y'
and MTL.enabled_flag = 'Y'
and mtl.inventory_item_id = c_inventory_item_id
and mtl.organization_id = c_inventory_org_id
order by 1;
SELECT DISTINCT MI.inventory_item_id,
MP.master_organization_id,
MI.comms_nl_trackable_flag
FROM MTL_PARAMETERS MP, MTL_SYSTEM_ITEMS_KFV MI
WHERE MP.master_organization_id = MI.organization_id
AND MI.inventory_item_id = c_inventory_item_id
AND MI.organization_id = c_inventory_org_id
AND MI.enabled_flag = 'Y'
AND SYSDATE BETWEEN NVL( MI.start_date_active, SYSDATE )
AND NVL( MI.end_date_active, SYSDATE )
AND DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',MP.eam_enabled_flag )='Y';
/*SELECT DISTINCT
mtl.INVENTORY_ITEM_ID ,
mtl.organization_id ,
mtl.comms_nl_trackable_flag
from MTL_SYSTEM_ITEMS_KFV MTL
, MTL_PARAMETERS MP
, fnd_lookup_values_vl IT
where
DECODE(AHL_UTIL_PKG.IS_PM_INSTALLED,'Y','Y',mp.eam_enabled_flag )='Y'
AND MTL.ORGANIZATION_ID = MP.MASTER_ORGANIZATION_ID
and sysdate between nvl( MTL.start_date_active, sysdate )
and nvl( MTL.end_date_active, sysdate )
and IT.lookup_code (+) = MTL.item_type
and IT.lookup_type (+) = 'ITEM_TYPE'
and MTL.enabled_flag = 'Y'
and mtl.inventory_item_id = c_inventory_item_id
and mtl.organization_id = c_inventory_org_id
order by 1;
SELECT DISTINCT class_code,
organization_id
FROM WIP_ACCOUNTING_CLASSES
WHERE description = c_accounting_class
AND class_type = 6;
SELECT DISTINCT class_code,
organization_id
FROM WIP_ACCOUNTING_CLASSES
WHERE class_code = c_accounting_class_code
AND organization_id = c_accounting_class_org_id
AND class_type = 6;
SELECT DISTINCT task_template_group_id
FROM JTF_TASK_TEMP_GROUPS_VL
WHERE trunc(sysdate) >= trunc(nvl(start_date_active, sysdate)) and
trunc(sysdate) < trunc(nvl(end_date_active, sysdate+1)) and
template_group_name = c_task_template_group;
SELECT DISTINCT task_template_group_id
FROM JTF_TASK_TEMP_GROUPS_VL
WHERE trunc(sysdate) >= trunc(nvl(start_date_active, sysdate)) and
trunc(sysdate) < trunc(nvl(end_date_active, sysdate+1)) and
task_template_group_id = c_task_template_group_id;
SELECT warranty_template_id
FROM AHL_WARRANTY_TEMPLATES_B
WHERE name = c_warranty_template_name
AND enabled_flag = 'Y';
SELECT warranty_template_id
FROM AHL_WARRANTY_TEMPLATES_B
WHERE warranty_template_id = c_warranty_template_id
AND enabled_flag = 'Y';
SELECT DISTINCT short_code
FROM QA_CHAR_VALUE_LOOKUPS_V
--WHERE description = c_qa_inspection_type_desc; fix for the bug 9397756
SELECT DISTINCT short_code
FROM QA_CHAR_VALUE_LOOKUPS_V
WHERE short_code = c_qa_inspection_type;
SELECT DISTINCT plan_id
FROM QA_PLANS_VAL_V
WHERE name = c_qa_plan;
SELECT DISTINCT plan_id
FROM QA_PLANS_VAL_V
WHERE plan_id = c_qa_plan_id;
SELECT DISTINCT item_group_id
FROM AHL_ITEM_GROUPS_VL
WHERE name = c_item_group_name
-- bug # 11833328 - sthilak - added the status=complete condition; sorao for backporting project
SELECT DISTINCT item_group_id
FROM AHL_ITEM_GROUPS_VL
WHERE item_group_id = c_item_group_id
-- bug # 11833328 - sthilak - added the status=complete condition; sorao for backporting project
SELECT DISTINCT ICD.item_comp_detail_id
FROM AHL_ITEM_COMP_DETAILS ICD
, AHL_ITEM_COMPOSITIONS CD
WHERE ICD.item_comp_detail_id = c_item_comp_detail_id
AND CD.APPROVAL_STATUS_CODE ='COMPLETE'
AND CD.item_composition_id = ICD.item_composition_id
AND nvl(trunc(CD.EFFECTIVE_END_DATE),trunc(sysdate+1)) > trunc(sysdate)
AND nvl(trunc(ICD.EFFECTIVE_END_DATE),trunc(sysdate+1)) > trunc(sysdate);
SELECT DISTINCT path_position_id
FROM AHL_MC_PATH_POSITIONS
WHERE position_ref_code = c_position_path;
select 'X'
FROM ahl_mc_relationships mcr,
ahl_mc_headers_b mch,
ahl_mc_path_position_nodes mcp
WHERE mcp.mc_id = mch.mc_id
AND mcp.SEQUENCE = ( SELECT MAX(SEQUENCE) FROM ahl_mc_path_position_nodes WHERE path_position_id = NVL(c_position_path_id,-1) )
AND mch.mc_header_id = mcr.mc_header_id
AND mch.version_number = NVL(mcp.version_number, mch.version_number)
AND mcp.position_key= mcr.position_key;
SELECT 'X'
FROM ahl_mc_path_position_nodes mcp ,
ahl_route_effectivities re
WHERE mcp.mc_id =re.mc_id
AND mcp.path_position_id=NVL(c_position_path_id,-1) and mcp.sequence=0;
SELECT DISTINCT
mcp.path_position_id
FROM
ahl_mc_relationships mcr,
ahl_mc_headers_b mch,
ahl_mc_path_position_nodes mcp,
ahl_route_effectivities re
WHERE
re.mc_id IS NOT NULL AND
re.mc_id = mch.mc_id AND
mch.mc_header_id =mcr.mc_header_id AND
mch.mc_id = mcp.mc_id AND
mch.version_number = NVL(mcp.version_number, mch.version_number) AND
mcr.position_key = mcp.position_key AND
mcp.SEQUENCE = ( SELECT MAX(SEQUENCE) FROM ahl_mc_path_position_nodes WHERE path_position_id = NVL(c_position_path_id,-1) ) AND
mcp.path_position_id = NVL(c_position_path_id,-1);
SELECT DISTINCT
mcp.path_position_id
FROM
ahl_mc_relationships mcr
, ahl_mc_headers_b mch
, ahl_mc_path_position_nodes mcp
, AHL_ROUTE_EFFECTIVITIES_V re
WHERE
mch.mc_header_id = mcr.mc_header_id
and mch.mc_id = mcp.mc_id
and re.MC_ID = mch.MC_ID
and mch.version_number = nvl(mcp.version_number, mch.version_number)
and mcr.position_key = mcp.position_key
and mcp.sequence = (select max(sequence) from ahl_mc_path_position_nodes where path_position_id = nvl(c_position_path_id,-1))
and mcp.path_position_id = nvl(c_position_path_id,-1);*/
SELECT DISTINCT mc_id
FROM AHL_MC_HEADERS_B
WHERE upper(name) = upper(c_mc_name)
AND CONFIG_STATUS_CODE='COMPLETE';
/*SELECT DISTINCT mc_id
FROM AHL_MC_HEADERS_V
WHERE upper(name) = upper(c_mc_name)
AND CONFIG_STATUS_CODE='COMPLETE';*/
SELECT DISTINCT mc_header_id, mc_id
FROM AHL_MC_HEADERS_B
WHERE upper(name) = upper(c_mc_name)
AND upper(revision)=upper(c_mc_revision_number)
AND CONFIG_STATUS_CODE='COMPLETE';
SELECT DISTINCT mc_header_id,
mc_id
FROM AHL_MC_HEADERS_V
WHERE upper(name) = upper(c_mc_name)
AND upper(revision)=upper(c_mc_revision_number)
AND CONFIG_STATUS_CODE='COMPLETE';*/
SELECT DISTINCT mc_header_id
FROM AHL_MC_HEADERS_V
WHERE mc_header_id = c_mc_header_id
AND CONFIG_STATUS_CODE='COMPLETE'
;
SELECT DISTINCT mc_id
FROM AHL_MC_HEADERS_V
WHERE mc_id = c_mc_id
AND CONFIG_STATUS_CODE='COMPLETE'
;
SELECT DISTINCT mc_id
FROM AHL_MC_HEADERS_V
WHERE mc_id = c_mc_id
AND CONFIG_STATUS_CODE='COMPLETE'
;
SELECT DISTINCT mc_header_id
FROM AHL_MC_HEADERS_V
WHERE mc_header_id = c_mc_header_id
AND CONFIG_STATUS_CODE='COMPLETE'
;
SELECT DISTINCT uom_code
FROM MTL_UNITS_OF_MEASURE_VL
WHERE upper(unit_of_measure) = upper(c_uom);
SELECT DISTINCT uom_code
FROM MTL_UNITS_OF_MEASURE_VL
WHERE upper(uom_code) = upper(c_uom_code);
SELECT 'X'
FROM AHL_ITEM_CLASS_UOM_V
WHERE uom_code = c_uom_code
AND inventory_item_id = c_inventory_item_id
AND inventory_org_id = c_inventory_org_id;
SELECT 'X'
FROM AHL_ITEM_CLASS_UOM_V UOM, AHL_ITEM_ASSOCIATIONS_B ASSOC
WHERE UOM.uom_code = c_uom_code
AND UOM.inventory_item_id = ASSOC.inventory_item_id
AND UOM.inventory_org_id = ASSOC.inventory_org_id
AND ASSOC.item_group_id = c_item_group_id;
SELECT 'X'
FROM AHL_PRODTYPE_ZONES
WHERE product_type_code = c_product_type_code
AND zone_code = c_zone_code
AND sub_zone_code IS NULL;
SELECT 'X'
FROM AHL_PRODTYPE_ZONES
WHERE product_type_code = c_product_type_code
AND zone_code = c_zone_code
AND sub_zone_code = c_sub_zone_code;
SELECT DISTINCT lookup_code
FROM MFG_LOOKUPS
WHERE lookup_type = c_lookup_type
AND UPPER(meaning) = UPPER(c_lookup_meaning)
AND SYSDATE BETWEEN NVL( start_date_active, SYSDATE ) AND
NVL( end_date_active, SYSDATE )
AND LOOKUP_CODE IN (c_lookup_code_1, c_lookup_code_2);
SELECT DISTINCT lookup_code
FROM MFG_LOOKUPS
WHERE lookup_type = c_lookup_type
AND lookup_code = c_lookup_code
AND SYSDATE BETWEEN NVL( start_date_active, SYSDATE ) AND
NVL( end_date_active, SYSDATE )
AND LOOKUP_CODE IN (c_lookup_code_1, c_lookup_code_2);
SELECT DISTINCT lookup_code
FROM MFG_LOOKUPS
WHERE lookup_type = c_lookup_type
AND UPPER(meaning) = UPPER(c_lookup_meaning)
AND SYSDATE BETWEEN NVL( start_date_active, SYSDATE ) AND
NVL( end_date_active, SYSDATE );
SELECT DISTINCT lookup_code
FROM MFG_LOOKUPS
WHERE lookup_type = c_lookup_type
AND lookup_code = c_lookup_code
AND SYSDATE BETWEEN NVL( start_date_active, SYSDATE ) AND
NVL( end_date_active, SYSDATE );
SELECT DISTINCT resource_id
FROM AHL_RESOURCES
WHERE UPPER(TRIM(name)) = UPPER(TRIM(c_aso_resource_name));
SELECT DISTINCT resource_id
FROM AHL_RESOURCES
WHERE resource_id = c_aso_resource_id;
SELECT DISTINCT resource_id,
organization_id
FROM BOM_RESOURCES
WHERE resource_code = c_bom_resource_code;
SELECT DISTINCT resource_id,
organization_id
FROM BOM_RESOURCES
WHERE resource_id = c_bom_resource_id
AND organization_id = c_bom_org_id;
select distinct DEPT.department_id
from bom_departments DEPT, BOM_DEPARTMENT_RESOURCES DEPT_RES, BOM_RESOURCES RES
where DEPT_RES.department_id = DEPT.department_id
and DEPT.description = c_bom_department_name
and DEPT_RES.resource_id = c_bom_resource_id
and DEPT.organization_id = c_bom_org_id;
SELECT DISTINCT activity_id
FROM CST_ACTIVITIES
WHERE activity = c_activity;
SELECT DISTINCT activity_id
FROM CST_ACTIVITIES
WHERE activity_id = c_activity_id;
SELECT DISTINCT competence_id
FROM PER_COMPETENCES
WHERE name = c_skill_name
AND business_group_id = c_business_group_id;
SELECT DISTINCT competence_id
FROM PER_COMPETENCES
WHERE competence_id = c_skill_competence_id
AND business_group_id = c_business_group_id;
SELECT DISTINCT rating_level_id
FROM PER_RATING_LEVELS
WHERE TO_CHAR( step_value ) || '-' || name = c_skill_level_desc
AND competence_id = c_skill_competence_id
AND business_group_id = c_business_group_id;
SELECT DISTINCT rating_level_id
FROM PER_RATING_LEVELS
WHERE rating_level_id = c_rating_level_id
AND competence_id = c_skill_competence_id
AND business_group_id = c_business_group_id;
SELECT DISTINCT qualification_type_id
FROM PER_QUALIFICATION_TYPES
WHERE name = c_qualification_type;
SELECT DISTINCT qualification_type_id
FROM PER_QUALIFICATION_TYPES
WHERE qualification_type_id = c_qualification_type_id;
SELECT revision_status_code
FROM ahl_routes_app_v
WHERE route_id = c_route_id;
SELECT ROUTE_ID
FROM AHL_ROUTE_EFFECTIVITIES
WHERE ROUTE_EFFECTIVITY_ID = c_efct_id;
/*SELECT ROUTE_ID
FROM AHL_ROUTE_EFFECTIVITIES_V
WHERE ROUTE_EFFECTIVITY_ID = c_efct_id;*/
SELECT ROUTE_NO
FROM AHL_ROUTES_B
WHERE ROUTE_ID = c_route_id AND
APPLICATION_USG_CODE=rtrim(ltrim(fnd_profile.value('AHL_APPLN_USAGE')));
/* SELECT ROUTE_NO
FROM AHL_ROUTES_V
WHERE ROUTE_ID = c_route_id;*/
SELECT revision_status_code
FROM ahl_operations_b
WHERE operation_id = c_operation_id;
SELECT MAX( duration )
FROM AHL_RT_OPER_RESOURCES
WHERE association_type_code = 'ROUTE'
AND object_id = c_route_id
AND scheduled_type_id = 1;
SELECT SUM(MAX(duration))
FROM AHL_RT_OPER_RESOURCES
WHERE association_type_code = 'ROUTE'
AND object_id = c_route_id
GROUP BY schedule_seq ;
SELECT MAX( RES.duration )
FROM AHL_RT_OPER_RESOURCES RES, AHL_OPERATIONS_B OPER, AHL_ROUTE_OPERATIONS ASS
WHERE RES.association_type_code = 'OPERATION'
AND RES.object_id = ASS.operation_id
AND NVL( OPER.end_date_active , TRUNC( SYSDATE ) + 1 ) > TRUNC( SYSDATE )
AND OPER.operation_id = ASS.operation_id
AND RES.scheduled_type_id = 1
AND ASS.route_id = c_route_id;
SELECT SUM(OPR_DURATION)
FROM
(SELECT RES.object_id,RES.schedule_seq, MAX(duration) "OPR_DURATION"
FROM AHL_RT_OPER_RESOURCES RES, AHL_OPERATIONS_B OPER, AHL_ROUTE_OPERATIONS ASS
WHERE RES.association_type_code = 'OPERATION'
AND RES.object_id = ASS.operation_id
AND NVL( OPER.end_date_active , TRUNC( SYSDATE ) + 1 ) > TRUNC( SYSDATE )
AND OPER.operation_id = ASS.operation_id
AND ASS.route_id = c_route_id
GROUP BY RES.object_id,RES.schedule_seq ) ;
SELECT MAX(OPER_DURATION)
FROM ( SELECT SUM(RES_DURATION) OPER_DURATION,
object_id
FROM (SELECT MAX(res.duration) RES_DURATION,
res.object_id
FROM ahl_rt_oper_resources res
WHERE res.association_type_code = 'OPERATION'
AND res.scheduled_type_id = 1
AND res.object_id IN
(SELECT oper.operation_id
FROM ahl_operations_b oper ,
ahl_route_operations ass ,
ahl_routes_app_v rou
WHERE
(
TRUNC(nvl(c_rou_start_date,rou.start_date_active)) >= TRUNC(oper.start_date_active)
AND
TRUNC(NVL(oper.end_date_active, nvl(c_rou_start_date,rou.start_date_active) + 1)) > TRUNC(nvl(c_rou_start_date,rou.start_date_active))
)
AND rou.route_id = c_route_id
AND oper.operation_id = ass.operation_id
AND ass.route_id = c_route_id
)
GROUP BY res.object_id,
res.schedule_seq
)
GROUP BY object_id
);*/
SELECT route_operation_id, oper_duration
FROM ( SELECT SUM(RES_DURATION) OPER_DURATION, object_id
FROM (SELECT MAX(res.duration) RES_DURATION, res.object_id
FROM ahl_rt_oper_resources res
WHERE res.association_type_code = 'OPERATION'
AND res.scheduled_type_id = 1
AND res.object_id IN
(SELECT oper.operation_id
FROM ahl_operations_b oper, ahl_route_operations ass , ahl_routes_app_v rou
WHERE (
TRUNC(nvl(c_rou_start_date,rou.start_date_active)) >= TRUNC(oper.start_date_active)
AND
TRUNC(NVL(oper.end_date_active, nvl(c_rou_start_date,rou.start_date_active) + 1)) > TRUNC(nvl(c_rou_start_date,rou.start_date_active))
)
AND rou.route_id = c_route_id
AND oper.operation_id = ass.operation_id
AND ass.route_id = c_route_id
) GROUP BY res.object_id, res.schedule_seq
) GROUP BY object_id
) res, ahl_route_operations ro
WHERE res.object_id = ro.operation_id
AND ro.route_id = c_route_id ;
SELECT SYS_CONNECT_BY_PATH(from_rt_op_id,'|')||'|'||to_rt_op_id Path
FROM ahl_rt_oper_dependencies od
WHERE dependency_code = 'STARTSAFTEREND' AND from_rt_op_id
IN ( SELECT route_operation_id
FROM ahl_route_operations
WHERE ROUTE_ID =c_route_id
AND route_operation_id =od.from_rt_op_id
)
START WITH from_rt_op_id = c_from_rt_op_id
CONNECT BY PRIOR to_rt_op_id = from_rt_op_id;
SELECT time_span
FROM AHL_ROUTES_APP_V
WHERE route_id = c_route_id;
SELECT MIN( RT.time_span )
FROM AHL_ROUTES_APP_V RT ,
AHL_ROUTE_OPERATIONS ASS,
AHL_OPERATIONS_B oper
WHERE ( TRUNC(RT.start_date_active) >= TRUNC(oper.start_date_active)
AND TRUNC(NVL(oper.end_date_active, RT.start_date_active + 1)) > TRUNC(RT.start_date_active)
)
AND TRUNC ( NVL ( RT.end_date_active , SYSDATE + 1 ) ) > TRUNC( SYSDATE )
AND oper.operation_id = ass.operation_id
AND RT.route_id = ASS.route_id
AND ASS.operation_id = c_operation_id;
SELECT time_span
FROM AHL_ROUTES_APP_V
WHERE route_id = c_route_id;
SELECT rou.time_span
FROM AHL_ROUTES_APP_V rou,
AHL_OPERATIONS_B oper
WHERE (
TRUNC(rou.start_date_active) >= TRUNC(oper.start_date_active)
AND
TRUNC(NVL(oper.end_date_active, rou.start_date_active + 1)) > TRUNC(rou.start_date_active)
)
AND oper.operation_id = c_operation_id
AND rou.route_id = c_route_id;
SELECT NVL(SUM(RES_DURATION),0)
FROM ( SELECT MAX( duration ) RES_DURATION
FROM AHL_RT_OPER_RESOURCES
WHERE association_type_code = 'OPERATION'
AND scheduled_type_id = 1
AND object_id = c_operation_id
GROUP BY schedule_seq
);
SELECT MAX( A.start_date_active )
FROM AHL_ROUTES_APP_V A, AHL_ROUTES_APP_V B
WHERE A.route_no = B.route_no
AND A.route_id <> c_route_id
AND B.route_id = c_route_id;
SELECT MAX( A.start_date_active )
FROM AHL_OPERATIONS_B_KFV A, AHL_OPERATIONS_B_KFV B
WHERE A.concatenated_segments = B.concatenated_segments
AND A.operation_id <> c_operation_id
AND B.operation_id = c_operation_id;
SELECT r.Application_usg_code
FROM AHL_ROUTES_B r
WHERE r.route_id = c_route_id
;
SELECT DISTINCT
fnd.MEANING
FROM
ahl_mc_relationships mcr
, ahl_mc_headers_b mch
, ahl_mc_path_position_nodes mcp
, AHL_ROUTE_EFFECTIVITIES_V re
, fnd_lookup_values_vl fnd
, AHL_RT_OPER_MATERIALS AOB
WHERE
mch.mc_header_id = mcr.mc_header_id
and mch.mc_id = mcp.mc_id
and re.MC_ID = mch.MC_ID
and mch.version_number = nvl(mcp.version_number, mch.version_number)
and mcr.position_key = mcp.position_key
and mcp.sequence = (select max(sequence) from ahl_mc_path_position_nodes where path_position_id = nvl(c_position_path_id,-1))
and mcp.path_position_id = nvl(c_position_path_id,-1)
and fnd.LOOKUP_TYPE = 'AHL_POSITION_REFERENCE'
and fnd.LOOKUP_CODE = mcr.POSITION_REF_CODE
;
SELECT DISTINCT MTL.CONCATENATED_SEGMENTS
, MTL.ORGANIZATION_CODE
FROM AHL_ITEM_COMP_DETAILS ICD
, AHL_ITEM_COMPOSITIONS CD
, AHL_MTL_ITEMS_NON_OU_V MTL
WHERE ICD.item_comp_detail_id = c_item_comp_detail_id
AND CD.APPROVAL_STATUS_CODE ='COMPLETE'
AND CD.item_composition_id = ICD.item_composition_id
AND CD.INVENTORY_ITEM_ID = MTL.INVENTORY_ITEM_ID
AND CD.INVENTORY_MASTER_ORG_ID = MTL.INVENTORY_ORG_ID
AND nvl(trunc(CD.EFFECTIVE_END_DATE),trunc(sysdate+1)) > trunc(sysdate)
AND nvl(trunc(ICD.EFFECTIVE_END_DATE),trunc(sysdate+1)) > trunc(sysdate)
;
select distinct mtl.concatenated_segments,
mtl.organization_code
from (select kfv.inventory_item_id,
mp.master_organization_id inventory_org_id,
mp.organization_code,
kfv.concatenated_segments
from mtl_system_items_kfv kfv,
mtl_parameters mp
where kfv.organization_id = mp.organization_id
and exists (select 'X'
from mtl_parameters mp1
where mp1.master_organization_id = kfv.organization_id
and mp1.eam_enabled_flag = 'Y')) mtl,
(select inventory_item_id,
inventory_org_id
from ahl_position_alternates_v
where relationship_id = c_position_path_id) pal,
(select item_composition_id,
item_comp_detail_id
from ahl_item_comp_details
where nvl(trunc(effective_end_date),trunc(sysdate + 1)) > trunc(sysdate)
and item_comp_detail_id = c_item_comp_detail_id) icd,
(select icb.item_composition_id,
icb.inventory_item_id,
icb.inventory_master_org_id,
decode(sign(trunc(nvl(icb.effective_end_date,sysdate + 1)) - trunc(sysdate)),1,icb.approval_status_code,'EXPIRED') approval_status_code,
icb.effective_end_date effective_end_date
from ahl_item_compositions icb
where approval_status_code = 'COMPLETE'
and nvl(trunc(effective_end_date),trunc(sysdate + 1)) > trunc(sysdate)) cd
where pal.inventory_item_id = mtl.inventory_item_id
and pal.inventory_org_id = mtl.inventory_org_id
and pal.inventory_item_id = cd.inventory_item_id
and pal.inventory_org_id = cd.inventory_master_org_id
and cd.item_composition_id = icd.item_composition_id;
/*select distinct
mtl.concatenated_segments ,
mtl.organization_code
from
ahl_mtl_items_non_ou_v mtl,
ahl_position_alternates_v pal,
AHL_ITEM_COMP_V CD ,
AHL_ITEM_COMP_DETAILS ICD
where
pal.relationship_id = nvl(c_position_path_id,'-1')
and pal.inventory_item_id = mtl.INVENTORY_ITEM_ID
and pal.inventory_org_id = mtl.INVENTORY_ORG_ID
and pal.inventory_item_id = CD.inventory_item_id
and pal.inventory_org_id = CD.inventory_master_org_id
AND CD.APPROVAL_STATUS_CODE = 'COMPLETE'
AND CD.item_composition_id = ICD.item_composition_id
AND nvl(trunc(CD.EFFECTIVE_END_DATE),trunc(sysdate+1)) > trunc(sysdate)
AND nvl(trunc(ICD.EFFECTIVE_END_DATE),trunc(sysdate+1)) > trunc(sysdate)
AND ICD.ITEM_COMP_DETAIL_ID=c_item_comp_detail_id;*/
SELECT DISTINCT
CD.concatenated_segments ,
CD.organization_code
FROM
ahl_mc_relationships mcr,
ahl_mc_headers_b mch,
ahl_mc_path_position_nodes mcp,
ahl_item_associations_v igass ,
AHL_ROUTE_EFFECTIVITIES re ,
-- ahl_mtl_items_non_ou_v mtl,
AHL_ITEM_COMP_V CD ,
AHL_ITEM_COMP_DETAILS ICD
WHERE
mch.mc_header_id = mcr.mc_header_id
and mch.mc_id = mcp.mc_id
and re.MC_ID = mch.MC_ID
and mch.version_number = nvl(mcp.version_number, mch.version_number)
and mcr.position_key = mcp.position_key
and mcp.sequence = (select max(sequence) from ahl_mc_path_position_nodes where path_position_id = nvl(p_position_path_id,'-1'))
and mcp.path_position_id = nvl(p_position_path_id,'-1')
and mcr.item_group_id = igass.item_group_id
and igass.INVENTORY_ITEM_ID = CD.inventory_item_id
and igass.INVENTORY_ORG_ID = CD.inventory_master_org_id
AND CD.APPROVAL_STATUS_CODE = 'COMPLETE'
AND CD.item_composition_id = ICD.item_composition_id
AND nvl(trunc(CD.EFFECTIVE_END_DATE),trunc(sysdate-1)) < trunc(sysdate)
AND ICD.ITEM_COMP_DETAIL_ID=c_item_comp_detail_id
order by 1
;
SELECT operation_id
FROM ahl_operations_vl
WHERE concatenated_segments = p_operation_number
AND
revision_number = p_operation_revision;
SELECT route_id
FROM ahl_routes_app_v
WHERE UPPER( TRIM(route_no)) = UPPER(TRIM(p_route_number))
AND
revision_number = p_route_revision;
SELECT mc_id
FROM AHL_MC_HEADERS_VL mc_header1
where
mc_header1.name = c_mc_name and
mc_header1.config_status_code = 'COMPLETE'
AND rowid = (SELECT MIN(rowid) FROM AHL_MC_HEADERS_VL where config_status_code = 'COMPLETE' and name = mc_header1.name);
SELECT mc_id
FROM AHL_MC_HEADERS_VL mc_header1
where
mc_header1.mc_id = c_mc_id and
mc_header1.config_status_code = 'COMPLETE'
AND rowid = (SELECT MIN(rowid) FROM AHL_MC_HEADERS_VL where config_status_code = 'COMPLETE' and mc_id = mc_header1.mc_id);
SELECT DISTINCT amr.position_key
FROM
AHL_MC_RELATIONSHIPS amr,
FND_LOOKUP_VALUES_VL flv,
AHL_MC_HEADERS_VL amh
WHERE
amr.mc_header_id = amh.mc_header_id AND
amh.mc_id = NVL(c_mc_id,-1) AND
amh.config_status_code = 'COMPLETE' AND
nvl(amr.active_end_date, SYSDATE + 1) > SYSDATE AND
flv.lookup_type = 'AHL_POSITION_REFERENCE' AND
NVL(flv.ENABLED_FLAG,'N') = 'Y' AND
NVL(flv.END_DATE_ACTIVE, SYSDATE +1 ) > SYSDATE AND
flv.lookup_code = amr.position_ref_code AND
flv.meaning = c_mc_position and
nvl(amr.parent_relationship_id, -1) not in (
select rel.relationship_id
from AHL_MC_PATH_POSITION_NODES ampp, AHL_MC_RULE_STATEMENTS amrs, ahl_mc_headers_b amh2,ahl_mc_rules_b mcrule,ahl_mc_relationships rel
where ampp.mc_id = c_mc_id and
ampp.path_position_node_id = amrs.subject_id and
amrs.subject_type = 'POSITION' and
amrs.operator = 'MUST_HAVE' and
amrs.object_type = 'TOT_CHILD_QUANTITY' and
amh2.mc_id = ampp.mc_id and
amh2.mc_header_id = mcrule.mc_header_id and
mcrule.rule_id = amrs.rule_id and
rel.position_key = ampp.position_key and
nvl(mcrule.active_end_date,SYSDATE +1) > SYSDATE and
amh2.config_status_code = 'COMPLETE' and
nvl(rel.active_end_date, SYSDATE + 1) > SYSDATE);
SELECT DISTINCT amr.position_key
FROM
AHL_MC_RELATIONSHIPS amr,
AHL_MC_HEADERS_VL amh
WHERE
amr.mc_header_id = amh.mc_header_id and
amh.mc_id = NVL(c_mc_id,-1) and
amh.config_status_code = 'COMPLETE' AND
nvl(amr.active_end_date, SYSDATE + 1) > SYSDATE AND
amr.position_key = c_mc_position_key and
nvl(amr.parent_relationship_id, -1) not in (
select rel.relationship_id
from AHL_MC_PATH_POSITION_NODES ampp, AHL_MC_RULE_STATEMENTS amrs, ahl_mc_headers_b amh2,ahl_mc_rules_b mcrule,ahl_mc_relationships rel
where ampp.mc_id = c_mc_id and
ampp.path_position_node_id = amrs.subject_id and
amrs.subject_type = 'POSITION' and
amrs.operator = 'MUST_HAVE' and
amrs.object_type = 'TOT_CHILD_QUANTITY' and
amh2.mc_id = ampp.mc_id and
amh2.mc_header_id = mcrule.mc_header_id and
mcrule.rule_id = amrs.rule_id and
rel.position_key = ampp.position_key and
nvl(mcrule.active_end_date,SYSDATE +1) > SYSDATE and
amh2.config_status_code = 'COMPLETE' and
nvl(rel.active_end_date, SYSDATE + 1) > SYSDATE);