The following lines contain the word 'select', 'insert', 'update' or 'delete':
select distinct msi.inventory_item_id , msi.primary_uom_code
from qp_list_headers_vl qph ,
qp_list_lines qpl ,
qp_pricing_attributes qpa,
mtl_system_items_b msi
where qph.list_header_id = l_lst_hdr_id
and qph.list_type_code = 'PRL'
and qph.list_header_id = qpl.list_header_id
and qpl.list_line_type_code = 'PLL'
and qpa.list_line_id = qpl.list_line_id
and qpa.product_attribute_context = 'ITEM'
and qpa.product_attribute = 'PRICING_ATTRIBUTE1'
and msi.organization_id = l_org_id
and msi.inventory_item_id = qpa.product_attr_value
and msi.inventory_asset_flag = 'Y'
/* Bug 4037114 .Servie items should be excluded and not servicable items
and msi.serviceable_product_flag = 'N' */
and msi.service_item_flag = 'N'
and ( p_range = 1
OR
( p_range = 2
AND msi.inventory_item_id = p_specific_item_id
)
OR
EXISTS
(SELECT NULL
FROM mtl_item_categories MIC
WHERE MIC.organization_id = p_organization_id
AND MIC.category_id = nvl(p_specific_category_id ,MIC.category_id)
AND MIC.category_set_id = nvl(p_category_set , -99999)
AND MIC.inventory_item_id = msi.inventory_item_id
AND p_range = 5)
);
select /*+ ORDERED USE_NL(b) */
adjusted_unit_price * nvl(priced_quantity,line_quantity),b.value_from
from qp_preq_lines_tmp a , qp_preq_line_attrs_tmp b
where a.line_index = b.line_index
and a.pricing_status_code = 'UPDATED'
and b.pricing_status_code = 'X'
and b.context = 'ITEM'
and b.attribute_type = 'PRODUCT'
and b.attribute = 'PRICING_ATTRIBUTE1' ;
SELECT nvl(process_enabled_flag,'N')
, organization_code
INTO l_process_enabled_flag
, l_organization_code
FROM mtl_parameters
WHERE organization_id = p_organization_id;
Select name
into l_price_list_name
from qp_list_headers_vl
where list_header_id = p_pl_hdr_id ;
Select FCR.argument18 into l_req_groupid
from FND_CONCURRENT_REQUESTS FCR
where FCR.concurrent_program_id = FND_GLOBAL.CONC_PROGRAM_ID
AND FCR.program_application_id = FND_GLOBAL.PROG_APPL_ID
AND FCR.request_id = FND_GLOBAL.CONC_REQUEST_ID;
Select min(FCR.request_id) into l_min_reqid
from FND_CONCURRENT_REQUESTS FCR
where FCR.concurrent_program_id = FND_GLOBAL.CONC_PROGRAM_ID
AND FCR.program_application_id = FND_GLOBAL.prog_appl_id
AND FCR.phase_code <> 'C'
AND FCR.argument14 = l_req_groupid;
select count(*) into l_base_count
from CST_ITEM_CST_DTLS_INTERFACE CICDI
where CICDI.group_id = l_req_groupid;
Select cost_organization_id
into l_cost_organization_id
from mtl_parameters MP
where MP.organization_id = p_organization_id;
Select currency_code
into l_org_currency_code
from cst_organization_definitions
where organization_id = p_organization_id;
Select qph.currency_code into l_list_currency_code
from qp_list_headers_vl qph
where qph.list_header_id = p_pl_hdr_id
and qph.list_type_code = 'PRL';
Select orig_org_id
into p_control_rec.org_id
from qp_list_headers_vl
where list_header_id = p_pl_hdr_id ;
Insert into CST_ITEM_CST_DTLS_INTERFACE (
Inventory_item_ID ,
Organization_id ,
Last_update_date ,
Last_updated_by ,
Creation_date ,
Created_by ,
Last_update_login ,
Program_id ,
Level_type ,
Cost_element_id ,
Resource_ID ,
Rollup_source_type ,
Request_ID ,
Basis_type ,
Usage_rate_or_amount,
Basis_factor ,
Based_on_rollup_flag,
Group_id ,
Group_description ,
Process_flag )
Values
(
l_item ,
p_organization_id,
sysdate ,
FND_GLOBAL.user_id,
sysdate ,
FND_GLOBAL.user_id,
FND_GLOBAL.user_id,
FND_GLOBAL.conc_program_id,
'1', -- This Level
'1', -- Material
p_def_mtl_subelement ,
'1', -- user defined
p_group_id ,
'1' , -- Item based
l_item_cost * nvl(l_conversion_rate, 1),
'1' ,
l_based_on_rollup,
p_group_id ,
l_price_list_name || ':'|| FND_GLOBAL.user_name
|| ':' || to_char(sysdate , 'DD-MON-RR' ) ,
1
) ;
FND_FILE.put_line(fnd_file.log,'Insert into interface failed for Item '
|| l_item ) ;
select count(*) into l_num_rows
from CST_ITEM_CST_DTLS_INTERFACE
where group_id = p_group_id ;
'Sucessfully inserted ' || to_char(l_num_rows)|| ' rows into CST_ITEM_CST_DTLS_INTERFACE table');
select CST_LISTS_S.currval
into l_group_id
from dual ;