The following lines contain the word 'select', 'insert', 'update' or 'delete':
select meaning
from fnd_lookup_values
where lookup_type = p_lookup_type
and lookup_code = p_lookup_code
and language = 'US';
select fnd_profile.value('MSD_DEM_SCHEMA')
from dual;
select table_name, column_name
from msd_dem_entities_inuse
where ebs_entity = 'PRL'
and demantra_entity = 'DISPLAY_UNIT'
and internal_name = p_prl_code;
msd_dem_common_utilities.log_message('Price List deleted. Please recreate the Price List');
msd_dem_common_utilities.log_debug('Price List deleted. Please recreate the Price List');
l_stmt_get_series_id := 'select forecast_type_id from ' || get_lookup_value('MSD_DEM_TABLES', 'COMPUTED_FIELDS') ||
' where computed_name = ''' || l_column_name || '''';
l_stmt := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_QUERY_SERIES') || ' tqs set tqs.load_option = 0, tqs.purge_option = 0 '
|| ' where tqs.id = (select tq.id from ' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_LIST') || ' tl '
|| ' ,' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_QUERY') || ' tq '
|| ' where tl.name = :1 '
|| ' and tq.transfer_id = tl.id) and tqs.series_id = ' || l_series_id;
select 1 from
msd_dem_entities_inuse
where internal_name = p_prl_code
and ebs_entity = 'PRL';
l_stmt_get_seeded_unit := 'select display_units from ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') ||
' where display_units = ''' || p_prl_code || '''';
l_stmt_new_prl_display_unit := 'select display_units ,display_units_id ,data_table ,data_field ' ||
' from ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') || ' ' ||
' where display_units_id in ' ||
' (select distinct display_units_id from ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') || ' ' ||
' minus ' ||
' select distinct display_units_id from ' || get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS_UNITS') || ' ' || ')' ||
' and display_units like ''%EBSPRICELIST%'' and rownum < 2';
l_stmt_get_profile_table := 'select tq.table_name from ' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_LIST') || ' tl '
|| ' ,' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_QUERY') || ' tq '
|| ' where tl.name = ''' || fnd_profile.value('MSD_DEM_PRICE_LIST_PROFILE') || ''''
|| ' and tq.transfer_id = tl.id';
l_stmt := 'insert into msd_dem_entities_inuse(
ebs_entity
,demantra_entity
,internal_name
,table_name
,column_name
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login
) values
(
''PRL''
,''DISPLAY_UNIT''
,:1
,:2
,:3
,:4
,:5
,:6
,:7
,:8
)';
l_stmt := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') ||
' set display_units = :1 ' ||
' where display_units_id = :2';
l_stmt := 'insert into ' || get_lookup_value('MSD_DEM_TABLES', 'AVAIL_UNITS') ||
' (group_table_id ,display_units_id )' ||
' (select group_table_id, :1 ' ||
' from ' || get_lookup_value('MSD_DEM_TABLES', 'GROUP_TABLES') ||
' where group_type = 1 ' ||
' )';
l_stmt_get_component := 'select dcm_product_id from ' ||get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS') || ' where product_name = ''' || msd_dem_common_utilities.get_lookup_value('MSD_DEM_COMPONENTS', 'DEMAND_MANAGEMENT') || '''';
l_stmt := 'insert into ' || get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS_UNITS') ||
' (dcm_product_id ,display_units_id) ' ||
' (select :1, :2 from dual)';
l_stmt := 'insert into ' || get_lookup_value('MSD_DEM_TABLES', 'INDEXES_FOR_UNITS') ||
' (display_units_id, real_value_id) ' ||
' (select :1, real_value_id from ' || get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS_INDEX') || ' dpi ' ||
' where dpi.dcm_product_id = ' || l_component_id ||
')';
l_stmt_get_component_sop := 'select dcm_product_id from ' ||get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS') || ' where product_name = ''' || msd_dem_common_utilities.get_lookup_value('MSD_DEM_COMPONENTS', 'SOP') || '''';
l_stmt := 'insert into ' || get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS_UNITS') ||
' (dcm_product_id ,display_units_id) ' ||
' (select :1, :2 from dual)';
l_stmt := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'COMPUTED_FIELDS')
|| ' set computed_title = :1 '
|| ' where computed_name = :2 ';
l_stmt := 'update msd_dem_entities_inuse set table_name = ''biio_ebs_price_list''' ||
', column_name = (select data_field from ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') || ' where display_units = :1)' ||
'where ebs_entity = ''PRL'' and demantra_entity = ''DISPLAY_UNIT'' and internal_name = :2';
l_stmt := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_QUERY_SERIES') || ' tqs set tqs.load_option = 2, tqs.purge_option = 0 '
|| ' where tqs.id = (select tq.id from ' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_LIST') || ' tl '
|| ' ,' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_QUERY') || ' tq '
|| ' where tl.name = :1 '
|| ' and tq.transfer_id = tl.id)';
l_stmt := 'select distinct price_list_name price_list_name
from msd_dem_price_lists_gtt';
l_stmt := 'select price_list_name from (' || l_stmt;
select count(*)
from msd_dem_price_lists;
select price_list_name
from msd_dem_price_lists;
msd_dem_common_utilities.log_message('Price list collection cannot continue as no price lists are selected in the price list form');
msd_dem_common_utilities.log_debug('Price list collection cannot continue as no price lists are selected in the price list form');
msd_dem_common_utilities.log_message('Include Price List does not contain any price list among the price lists, which are selected in the price list form.');
msd_dem_common_utilities.log_debug('Include Price List does not contain any price list among the price lists, which are selected in the price list form.');
x_stmt:= 'SELECT tq.id FROM ' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_LIST') || ' tl '
|| ' ,' || get_lookup_value('MSD_DEM_TABLES', 'TRANSFER_QUERY') || ' tq '
|| ' WHERE tl.name = ''' || fnd_profile.value('MSD_DEM_PRICE_LIST_PROFILE') || ''''
|| ' AND tq.transfer_id = tl.id';
msd_dem_common_utilities.log_message('WARNING: Failed to update the price list data profile');
procedure delete_price_lists(errbuf out nocopy varchar2,
retcode out nocopy number,
p_list in varchar2)
as
cursor entities_inuse_cur(p_price_list_name varchar2) is
select internal_name, column_name
from msd_dem_entities_inuse
where internal_name = p_price_list_name
and ebs_entity = 'PRL';
l_stmt_deletes varchar2(1000);
l_stmt_updates varchar2(1000);
l_stmt_prl_display_unit_id := 'select display_units_id ' ||
' from ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') ||
' where display_units = ''' || l_internal_name || '''';
l_stmt_deletes := 'delete from ' || get_lookup_value('MSD_DEM_TABLES', 'AVAIL_UNITS') ||
' where display_units_id = :1';
msd_dem_common_utilities.log_message(l_stmt_deletes);
msd_dem_common_utilities.log_debug(l_stmt_deletes);
execute immediate l_stmt_deletes using l_display_unit_id;
l_stmt_deletes := 'delete from ' || get_lookup_value('MSD_DEM_TABLES', 'DCM_PRODUCTS_UNITS') ||
' where display_units_id = :1';
msd_dem_common_utilities.log_message(l_stmt_deletes);
msd_dem_common_utilities.log_debug(l_stmt_deletes);
execute immediate l_stmt_deletes using l_display_unit_id;
l_stmt_deletes := 'delete from ' || get_lookup_value('MSD_DEM_TABLES', 'INDEXES_FOR_UNITS') ||
' where display_units_id = :1';
msd_dem_common_utilities.log_message(l_stmt_deletes);
msd_dem_common_utilities.log_debug(l_stmt_deletes);
execute immediate l_stmt_deletes using l_display_unit_id;
l_stmt_updates := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'DISPLAY_UNITS') ||
' set display_units = :1 where display_units_id = :2';
msd_dem_common_utilities.log_message(l_stmt_updates);
msd_dem_common_utilities.log_debug(l_stmt_updates);
execute immediate l_stmt_updates using l_column_name, l_display_unit_id;
l_stmt_updates := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'COMPUTED_FIELDS') ||
' set computed_title = :1 ' ||
' where computed_name = :2 ';
msd_dem_common_utilities.log_message(l_stmt_updates);
msd_dem_common_utilities.log_debug(l_stmt_updates);
execute immediate l_stmt_updates using l_column_name, l_column_name;
l_stmt_deletes := 'delete from msd_dem_entities_inuse' ||
' where internal_name = :1 and ebs_entity = ''PRL''';
msd_dem_common_utilities.log_message(l_stmt_deletes);
msd_dem_common_utilities.log_debug(l_stmt_deletes);
execute immediate l_stmt_deletes using l_internal_name;
l_stmt_updates := 'update ' || get_lookup_value('MSD_DEM_TABLES', 'SALES_DATA') ||
' set ' || l_column_name || ' = null';
msd_dem_common_utilities.log_message(l_stmt_updates);
msd_dem_common_utilities.log_debug(l_stmt_updates);
execute immediate l_stmt_updates;
msd_dem_common_utilities.log_message('Deleted price list ' || l_internal_name);
msd_dem_common_utilities.log_debug('Deleted price list ' || l_internal_name);