The following lines contain the word 'select', 'insert', 'update' or 'delete':
g_product_segments.DELETE;
g_structure_segments.DELETE;
SELECT parent_flex_value_set_id
FROM fnd_flex_value_sets
WHERE flex_value_set_id = p_value_set_id;
SELECT category_set_id
FROM mtl_default_category_sets
WHERE functional_area_id = 2;
SELECT structure_id
FROM mtl_category_sets
WHERE category_set_id = g_default_po_category_set_id;
FOR x IN (SELECT profile_option_value
FROM fnd_profile_option_values
WHERE profile_option_id IN
(SELECT profile_option_id
FROM fnd_profile_options
WHERE profile_option_name = g_product_segment_profile_name
AND level_id = 10001
AND level_value = 0
)
) LOOP
g_product_segment_definition := x.profile_option_value;
'select ' ||
g_product_segments(p_product_segment_index).meaning_column || ' description' ||
' from ' ||
g_product_segments(p_product_segment_index).table_name || ' where (' ||
l_id_or_value || ' = :1 )';
select instr(g_product_segments(p_product_segment_index).where_clause,'ORDER BY') INTO l_index from dual;
select instr(g_product_segments(p_product_segment_index).where_clause,'order by') INTO l_index from dual;
SELECT SubStr(g_product_segments(p_product_segment_index).where_clause,1,l_index-1) INTO l_string FROM dual;
'select ' ||
g_product_segments(p_product_segment_index).meaning_column || ' description' ||
' from ' ||
g_product_segments(p_product_segment_index).table_name ||
' ' || l_string || ' and (' ||
l_id_or_value || ' = :1 )';
'select description from fnd_flex_values_vl ' ||
'where flex_value_set_id = :1 and flex_value = :2 ';
'select description from fnd_flex_values_vl ' ||
' where flex_value_set_id = :1 and flex_value = :2 and parent_flex_value_low = :3';
SELECT * FROM pos_sup_products_services
WHERE classification_id = p_classification_id;
l_query := 'select mcb.category_id from mtl_categories_b mcb, ' ||
' mtl_category_set_valid_cats mcsvc, pos_sup_products_services psps where ' ||
' (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y'' or mcb.supplier_enabled_flag = ''y'') ' ||
' and mcsvc.category_set_id = ' || g_default_po_category_set_id ||
' and mcb.category_id = mcsvc.category_id ' ||
' and psps.classification_id = :1 and (';
SELECT * FROM pos_sup_products_services
WHERE classification_id = p_classification_id;
l_query := 'select psps.vendor_id, mcb.category_id from mtl_categories_b mcb, ' ||
' mtl_category_set_valid_cats mcsvc, pos_sup_products_services psps where ' ||
' (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y'' or mcb.supplier_enabled_flag = ''y'') ' ||
' and mcsvc.category_set_id = ' || g_default_po_category_set_id ||
' and mcb.category_id = mcsvc.category_id and (';
PROCEDURE insert_into_glb_temp
(
p_validation_type IN VARCHAR2,
p_curr_seg_val_id IN NUMBER,
p_parent_seg_val_id IN NUMBER,
p_table_name IN VARCHAR2,
p_where_clause IN VARCHAR2,
p_meaning IN VARCHAR2,
p_id_column IN VARCHAR2,
p_value_column IN VARCHAR2,
p_column_name IN VARCHAR2,
p_parent_column_name IN VARCHAR2,
x_return_status OUT nocopy VARCHAR2,
x_msg_count OUT nocopy NUMBER,
x_msg_data OUT nocopy VARCHAR2
) IS
l_sql varchar2(4000) := null;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_validation_type : '||p_validation_type);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_curr_seg_val_id : '||p_curr_seg_val_id);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_parent_seg_val_id : '||p_parent_seg_val_id);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_table_name : '||p_table_name);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_where_clause : '||p_where_clause);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_meaning : '||p_meaning);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_id_column : '||p_id_column);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_value_column : '||p_value_column);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_column_name : '||p_column_name);
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'p_parent_column_name : '||p_parent_column_name);
l_tbl_sql := 'SELECT ffvl.flex_value,
ffvl.description,
ffvl.flex_value_id
FROM fnd_flex_values_vl ffvl,
mtl_categories_b mcb,
mtl_category_set_valid_cats mcsvc
WHERE ffvl.flex_value_set_id = '|| p_curr_seg_val_id ||
' AND mcb.category_id = mcsvc.category_id
and (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y'' or mcb.supplier_enabled_flag = ''y'')
AND mcsvc.category_set_id =' || g_default_po_category_set_id ||
' AND ffvl.flex_value = mcb.' || p_column_name || ' and not exists (select SEGMENT_VALUE_ID
from pos_products_services_gt
where SEGMENT_VALUE_ID = ffvl.flex_value_id )';
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'l_tbl_sql (I) : '||l_tbl_sql);
select Count(*) INTO l_count FROM pos_products_services_gt WHERE SEGMENT_VALUE_ID = l_value_id ;
insert into pos_products_services_gt(SEGMENT_VALUE ,
SEGMENT_VALUE_DESCRIPTION ,
SUPPLIER_SELECTION ,
PARENT_SEGMENT_VALUE ,
PARENT_SEGMENT_VALUE_ID ,
HIERARCHY_LEVEL ,
SEGMENT_VALUE_ID ,
LAST_UPDATE_DATE ,
LAST_UPDATED_BY ,
LAST_UPDATE_LOGIN ,
CREATION_DATE ,
CREATED_BY )
values(l_value,
l_description,
null,
null,
null,
null,
l_value_id,
sysdate,
fnd_global.user_id,
fnd_global.login_id,
sysdate,
fnd_global.user_id);
l_sql := 'select ffvl.flex_value,
ffvl.flex_value_id
from fnd_flex_values_vl ffvl,
mtl_categories_b mcb,
mtl_category_set_valid_cats mcsvc
where ffvl.flex_value_set_id = ' || p_parent_seg_val_id || ' AND
mcb.category_id = mcsvc.category_id
and (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y'' or mcb.supplier_enabled_flag = ''y'')
AND mcsvc.category_set_id = '|| g_default_po_category_set_id ||
' AND ffvl.flex_value = mcb.' || p_parent_column_name ;
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'l_sql : '||l_sql);
l_tbl_sql := 'SELECT ffvl2.flex_value,
ffvl2.description,
ffvl2.flex_value_id
FROM fnd_flex_values_vl ffvl2,
mtl_categories_b mcb1,
mtl_category_set_valid_cats mcsvc1
WHERE ffvl2.flex_value_set_id = ' || p_curr_seg_val_id || ' and
mcb1.category_id = mcsvc1.category_id AND
(mcb1.supplier_enabled_flag is null or mcb1.supplier_enabled_flag = ''Y'' or mcb1.supplier_enabled_flag = ''y'') and
mcsvc1.category_set_id = '|| g_default_po_category_set_id || ' AND
ffvl2.flex_value = mcb1.'|| p_column_name || ' and
ffvl2.parent_flex_value_low = mcb1.'|| p_parent_column_name || ' and
ffvl2.parent_flex_value_low = '||'''' || l_parent_value || '''' ||' and
not exists (select SEGMENT_VALUE_ID
from pos_products_services_gt
where SEGMENT_VALUE_ID = ffvl2.flex_value_id)' ;
'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'l_tbl_sql (D) : '||l_tbl_sql);
select Count(*) INTO l_count FROM pos_products_services_gt WHERE SEGMENT_VALUE_ID = l_value_id ;
insert into pos_products_services_gt(SEGMENT_VALUE ,
SEGMENT_VALUE_DESCRIPTION ,
SUPPLIER_SELECTION ,
PARENT_SEGMENT_VALUE ,
PARENT_SEGMENT_VALUE_ID ,
HIERARCHY_LEVEL ,
SEGMENT_VALUE_ID ,
LAST_UPDATE_DATE ,
LAST_UPDATED_BY ,
LAST_UPDATE_LOGIN ,
CREATION_DATE ,
CREATED_BY )
values(l_value,
l_description,
null,
l_parent_value,
l_parent_value_id,
null,
l_value_id,
sysdate,
fnd_global.user_id,
fnd_global.login_id,
sysdate,
fnd_global.user_id);
l_tbl_sql := 'select distinct mcb.'||p_column_name || ' value,
x.description description
from mtl_categories_b mcb, mtl_category_set_valid_cats mcsvc,(SELECT '||p_meaning||' description, '||
l_valorid_col||' value '||
' FROM '||p_table_name||' '||
p_where_clause||
') x where mcb.' || p_column_name ||' is not null
and (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y''
or mcb.supplier_enabled_flag = ''y'')
and mcb.category_id = mcsvc.category_id and mcsvc.category_set_id ='||g_default_po_category_set_id || ' and
To_Char(x.value) = mcb.'||p_column_name|| ' AND NOT EXISTS (select SEGMENT_VALUE_ID from pos_products_services_gt where SEGMENT_VALUE_ID = x.value ) ';
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'l_tbl_sql (T1) : '||l_tbl_sql);
l_tbl_sql := 'select distinct mcb.' ||p_column_name ||' value,
x.description description
from mtl_categories_b mcb, mtl_category_set_valid_cats mcsvc,'||'(SELECT '||p_meaning||' description, '||
l_valorid_col||' value '||
' FROM '||p_table_name|| ') x where mcb.' || p_column_name ||' is not null
and (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y''
or mcb.supplier_enabled_flag = ''y'')
and mcb.category_id = mcsvc.category_id and mcsvc.category_set_id ='||g_default_po_category_set_id || ' and
To_Char(x.value) = mcb.'||p_column_name||
' and NOT EXISTS (select SEGMENT_VALUE_ID from pos_products_services_gt where SEGMENT_VALUE_ID = x.value ) ';
FND_LOG.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.pos_product_service_utl_pkg.insert_into_glb_temp.begin', 'l_tbl_sql (T2) : '||l_tbl_sql);
insert into pos_products_services_gt(SEGMENT_VALUE ,
SEGMENT_VALUE_DESCRIPTION ,
SUPPLIER_SELECTION ,
PARENT_SEGMENT_VALUE ,
PARENT_SEGMENT_VALUE_ID ,
HIERARCHY_LEVEL ,
SEGMENT_VALUE_ID ,
LAST_UPDATE_DATE ,
LAST_UPDATED_BY ,
LAST_UPDATE_LOGIN ,
CREATION_DATE ,
CREATED_BY )
values(l_value,
l_description,
null,
null,
null,
null,
l_value,
sysdate,
fnd_global.user_id,
fnd_global.login_id,
sysdate,
fnd_global.user_id);
x_msg_data := 'Insert into Global temp failed ';
END insert_into_glb_temp;
SELECT SEGMENT_VALUE_DESCRIPTION
FROM pos_products_services_gt
START WITH segment_value_id = x_segment_value_id
CONNECT BY PRIOR parent_segment_value_id =segment_value_id
ORDER BY parent_segment_value_id DESC;
SELECT SEGMENT_VALUE
FROM pos_products_services_gt
START WITH segment_value_id = x_segment_value_id
CONNECT BY PRIOR parent_segment_value_id =segment_value_id
ORDER BY parent_segment_value_id DESC;
l_sql := 'SELECT classification_id
FROM pos_sup_products_services
WHERE '||l_concat_value||'='||''''||l_segcode_val||''''||
'AND status <> '||''''||'X'||''''||
'AND vendor_id = '||x_vendor_id||
'union all
select PS_REQUEST_ID classification_id
from POS_PRODUCT_SERVICE_REQUESTS psr , POS_SUPPLIER_MAPPINGS pmapp
WHERE '||l_concat_value||'='||''''||l_segcode_val||''''||
'and pmapp.mapping_id = psr.MAPPING_ID
AND (psr.REQUEST_STATUS =''PENDING'' or psr.REQUEST_STATUS =''REJECTED'')
AND pmapp.vendor_id = '||x_vendor_id ;
/* check if the immediate parent has been already selected. If so return the classification Id of the parent for the children .
This will disable the children on the screen so user cannot select them again
*/
if (l_class_id = 0) then
if (instr(l_concat_value,g_delimiter,-1) <> 0 ) then
l_next_seg := substr(l_concat_value,instr(l_concat_value,g_delimiter,-1)+4);
l_parent_sql := 'SELECT classification_id
FROM pos_sup_products_services
WHERE '||l_concat_value||'='||''''||l_segcode_val||''''||
'AND '||l_next_seg||' is null '||
'AND status <> '||''''||'X'||''''||
'AND vendor_id = '||x_vendor_id||
'union all
select PS_REQUEST_ID classification_id
from POS_PRODUCT_SERVICE_REQUESTS psr , POS_SUPPLIER_MAPPINGS pmapp
WHERE '||l_concat_value||'='||''''||l_segcode_val||''''||
'AND '||l_next_seg||' is null '||
'and pmapp.mapping_id = psr.MAPPING_ID
AND (psr.REQUEST_STATUS ='||''''||'PENDING'||''''|| 'or psr.REQUEST_STATUS ='||''''|| 'REJECTED'||''''||')
AND pmapp.vendor_id = '||x_vendor_id ;
l_sql := 'select PS_REQUEST_ID
from POS_PRODUCT_SERVICE_REQUESTS
WHERE '||l_concat_value||'='||''''||l_segcode_val||''''||
'and MAPPING_ID='||x_mapp_id||
'AND REQUEST_STATUS =''PENDING'' ';
/* check if the immediate parent has been already selected. If so return the classification Id of the parent for the children .
This will disable the children on the screen so user cannot select them again
*/
if (l_class_id = 0) then
if (instr(l_concat_value,g_delimiter,-1) <> 0 ) then
l_next_seg := substr(l_concat_value,instr(l_concat_value,g_delimiter,-1)+4);
select PS_REQUEST_ID
from POS_PRODUCT_SERVICE_REQUESTS
WHERE '||l_concat_value||'='||''''||l_segcode_val||''''||
'AND '||l_next_seg||' is null '||
'and MAPPING_ID='||x_mapp_id||
'AND REQUEST_STATUS =''PENDING''';
(select segment1 , segment2, segment3 , segment4,segment5 , segment6,segment7 , segment8,segment9 , segment10,
segment11 , segment12,segment13 , segment14,segment15 , segment16,segment17 , segment18,segment19 , segment20
from pos_sup_products_services
where classification_id = x_classification_id)
UNION ALL
(select segment1 , segment2, segment3 , segment4,segment5 , segment6,segment7 , segment8,segment9 , segment10,
segment11 , segment12,segment13 , segment14,segment15 , segment16,segment17 , segment18,segment19 , segment20
from POS_PRODUCT_SERVICE_REQUESTS
where PS_REQUEST_ID = x_classification_id);
l_query := 'select mcb.category_id from mtl_categories_b mcb, ' ||
' mtl_category_set_valid_cats mcsvc, pos_product_service_requests ppsr where ' ||
' (mcb.supplier_enabled_flag is null or mcb.supplier_enabled_flag = ''Y'' or mcb.supplier_enabled_flag = ''y'') ' ||
' and mcsvc.category_set_id = ' || g_default_po_category_set_id ||
' and mcb.category_id = mcsvc.category_id ' ||
' and ppsr.ps_request_id = :1 and (';
SELECT * FROM pos_product_service_requests
WHERE ps_request_id = p_ps_request_id;
* insert a record into the pos_supplier_mappings table for corresponding vendor id and party id
* else, use the existing mapping_id value of the party id to create a Pending Product and
* Service Request.
* Please refer the bug 7374266 for more information.
*/
SELECT party_id
INTO l_party_id
FROM AP_SUPPLIERS
WHERE vendor_id = p_vendor_id;
SELECT COUNT(mapping_id)
INTO l_count
FROM pos_supplier_mappings
WHERE party_id = l_party_id;
INSERT INTO pos_supplier_mappings
(
mapping_id, party_id , vendor_id ,
created_by, creation_date,
last_updated_by, last_update_date, last_update_login
)
VALUES
(
pos_supplier_mapping_s.nextval, l_party_id, p_vendor_id,
fnd_global.user_id, sysdate,
fnd_global.user_id, sysdate, fnd_global.login_id
);
select mapping_id
into l_mapping_id
from Pos_supplier_mappings
where vendor_id = p_vendor_id ;
INSERT INTO POS_PRODUCT_SERVICE_REQUESTS
(
PS_REQUEST_ID
, MAPPING_ID
, segment1
, segment2
, segment3
, segment4
, segment5
, segment6
, segment7
, segment8
, segment9
, segment10
, segment11
, segment12
, segment13
, segment14
, segment15
, segment16
, segment17
, segment18
, segment19
, segment20
, request_status
, request_type
, segment_definition
, created_by
, creation_date
, last_updated_by
, last_update_date
, last_update_login
)
VALUES
(
POS_PRODUCT_SERVICE_REQ_S.NEXTVAL
, l_mapping_id
, p_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
, 'PENDING'
, 'ADD'
, p_segment_definition
, fnd_global.user_id
, Sysdate
, fnd_global.user_id
, Sysdate
, fnd_global.login_id
);
PROCEDURE update_main_ps_req
( p_req_id_tbl IN po_tbl_number,
p_status IN VARCHAR2,
x_return_status OUT nocopy VARCHAR2,
x_msg_count OUT nocopy NUMBER,
x_msg_data OUT nocopy VARCHAR2
)
IS
BEGIN
for i in 1..p_req_id_tbl.COUNT LOOP
UPDATE POS_SUP_PRODUCTS_SERVICES
SET status = p_status,
last_updated_by = fnd_global.user_id,
last_update_date = Sysdate,
last_update_login = fnd_global.login_id
WHERE classification_id = p_req_id_tbl(i);
END update_main_ps_req;
UPDATE POS_PRODUCT_SERVICE_REQUESTS
SET request_status = 'DELETED',
last_updated_by = fnd_global.user_id,
last_update_date = Sysdate,
last_update_login = fnd_global.login_id
WHERE PS_REQUEST_ID = p_req_id_tbl(i);
UPDATE POS_PRODUCT_SERVICE_REQUESTS
SET request_status = 'PENDING',
request_type = 'ADD',
last_updated_by = fnd_global.user_id,
last_update_date = Sysdate,
last_update_login = fnd_global.login_id
WHERE PS_REQUEST_ID = p_req_id_tbl(i);
SELECT code, meaning
FROM table(pos_product_service_utl_pkg.product_service_ocv)
*/
PROCEDURE insert_into_ocv_table
(p_ocv_table IN OUT NOCOPY product_service_ocv_table,
p_parent_val IN VARCHAR2,
p_concat_parent_vals IN VARCHAR2,
p_concat_parent_desc IN VARCHAR2,
p_level IN NUMBER
)
IS
l_product_segment product_segment_record;
SELECT flex_value, description
FROM fnd_flex_values_vl
WHERE flex_value_set_id = p_value_set_id;
SELECT flex_value, description
FROM fnd_flex_values_vl
WHERE flex_value_set_id = p_value_set_id
AND parent_flex_value_low = p_parent_val;
l_tbl_sql := 'SELECT '||l_valorid_col||' value, '||
l_product_segment.meaning_column||' description '||
' FROM ' ||l_product_segment.table_name||
' ' ||l_product_segment.where_clause;
insert_into_ocv_table(p_ocv_table,
l_curr_segment_vals(i).code,
l_curr_val.code,
l_curr_val.meaning,
p_level + 1);
END insert_into_ocv_table;
insert_into_ocv_table(l_product_service_ocv,
null,
l_concat_parent_vals,
l_concat_parent_desc,
1);