The following lines contain the word 'select', 'insert', 'update' or 'delete':
x_sql := 'SELECT multi_org_flag FROM fnd_product_groups' || g_dblink ||
' WHERE product_group_type = ''Standard''';
It is recommended to set the profile to selectively collect these level values.
To collect all the available geography dimension level values, please clear
out the dummy profile value. Until the profile value is set appropriately or
cleared out, only the dummy level value (other) will be collected into
Demand Management for geography dimension.';
x_sql := 'SELECT count(*) FROM msd_dem_setup_parameters' || g_dblink;
msd_dem_common_utilities.log_message ('If this is not the master org, please update the MSD_DEM_MASTER_ORG profile on the Source');
x_sql := 'DELETE FROM msd_dem_setup_parameters' || g_dblink;
msd_dem_common_utilities.log_message ('Inserting profiles into source msd_dem_setup_parameters');
x_sql := 'INSERT INTO msd_dem_setup_parameters' || g_dblink ||
' (parameter_name, parameter_value, last_update_date, last_updated_by, creation_date, ' ||
' created_by, last_update_login) values (:1, :2, sysdate, :3, sysdate, ' ||
' :4, :5)';
x_sql := 'DELETE FROM msd_dem_setup_parameters';
msd_dem_common_utilities.log_message ('Inserting profiles into destination msd_dem_setup_parameters');
x_sql := 'INSERT INTO msd_dem_setup_parameters' ||
' (parameter_name, parameter_value, last_update_date, last_updated_by, creation_date, ' ||
' created_by, last_update_login) values (:1, :2, sysdate, :3, sysdate, ' ||
' :4, :5)';
x_sql := 'DELETE FROM msd_dem_app_instance_orgs' || g_dblink;
msd_dem_common_utilities.log_message ('Inserting Organizations into source msd_dem_app_instance_orgs');
x_sql := 'INSERT INTO msd_dem_app_instance_orgs' || g_dblink ||
' ( organization_id, organization_code, last_update_date, last_updated_by, creation_date, ' ||
' created_by, last_update_login) ' ||
' SELECT mtp.sr_tp_id, mtp.organization_code, sysdate, :a1, sysdate, ' ||
' :a2, :a3 ' ||
' FROM msc_instance_orgs mio, ' ||
' msc_trading_partners mtp ' ||
' WHERE mio.sr_instance_id = :1 ' ||
' AND nvl(mio.org_group, ''-888'') = decode( :2, ''-999'', nvl(mio.org_group, ''-888''), :3) ' ||
' AND nvl(mio.dp_enabled_flag, mio.enabled_flag) = 1 ' ||
' AND mtp.sr_instance_id = mio.sr_instance_id ' ||
' AND mtp.sr_tp_id = mio.organization_id ' ||
' AND mtp.partner_type = 3';
x_sql := 'DELETE FROM msd_dem_app_instance_orgs' || g_dblink || ' mdaio ' ||
' WHERE NOT EXISTS (SELECT 1 from hr_organization_information' || g_dblink || ' hoi ' ||
' WHERE hoi.organization_id = mdaio.organization_id ' ||
' AND hoi.org_information_context = ''CLASS'' ' ||
' AND hoi.org_information1 = ''SPF'' ' ||
' AND hoi.org_information2 = ''Y'') ';
x_sql := 'DELETE FROM msd_dem_app_instance_orgs' || g_dblink || ' mdaio ' ||
' WHERE EXISTS (SELECT 1 from hr_organization_information' || g_dblink || ' hoi ' ||
' WHERE hoi.organization_id = mdaio.organization_id ' ||
' AND hoi.org_information_context = ''CLASS'' ' ||
' AND hoi.org_information1 = ''SPF'' ' ||
' AND hoi.org_information2 = ''Y'') ';
x_sql := 'DELETE FROM msd_dem_app_instance_orgs';
msd_dem_common_utilities.log_message ('Inserting Organizations into destination msd_dem_app_instance_orgs');
x_sql := 'INSERT INTO msd_dem_app_instance_orgs' ||
' ( organization_id, organization_code, last_update_date, last_updated_by, creation_date, ' ||
' created_by, last_update_login) ' ||
' SELECT organization_id, organization_code, sysdate, :1, sysdate, :2, :3 ' ||
' FROM msd_dem_app_instance_orgs' || g_dblink;
SELECT meaning
FROM fnd_lookup_values_vl
WHERE lookup_type = 'MSD_DEM_TABLES'
AND lookup_code = p_lookup_code;
x_sql := 'DELETE FROM msd_dem_dates' || g_dblink;
x_sql := 'SELECT time_bucket, first_day_of_week, aggregation_method ' ||
' FROM ' || x_dm_table ||
' WHERE dm_or_template = 2 ' ||
' AND is_active = 1 ';
msd_dem_common_utilities.log_message ('Lowest Time Bucket - Day : Time data not inserted into source msd_dem_dates');
msd_dem_common_utilities.log_message ('Inserting time data into source msd_dem_dates');
x_sql := 'INSERT INTO msd_dem_dates' || g_dblink ||
' (datet, num_of_days, start_date, end_date, last_update_date, last_updated_by, creation_date, created_by, last_update_login) ' ||
' SELECT datet, num_of_days, ' || x_start_date || x_end_date || ',' ||
' sysdate, :1, sysdate, :2, :3 ' ||
' FROM ' || x_source_time_table;
msd_dem_common_utilities.log_debug('SQL for inserting data into source msd_dem_dates : ');
x_sql := 'DELETE FROM msd_dem_dates';
msd_dem_common_utilities.log_message ('Inserting time data into destination msd_dem_dates');
x_sql := 'INSERT INTO msd_dem_dates' ||
' (datet, num_of_days, start_date, end_date, last_update_date, last_updated_by, creation_date, created_by, last_update_login) ' ||
' SELECT datet, num_of_days, ' || x_start_date || x_end_date || ',' ||
' sysdate, :1, sysdate, :2, :3 ' ||
' FROM ' || x_source_time_table;
msd_dem_common_utilities.log_debug('SQL for inserting data into destination msd_dem_dates : ');
x_sql := 'DELETE FROM msd_dem_day_dates';
msd_dem_common_utilities.log_message ('Inserting time data into destination msd_dem_day_dates');
x_sql := 'INSERT INTO msd_dem_day_dates' ||
' (day_date, bucket_date, bucket_start_date, bucket_end_date, last_update_date, last_updated_by, creation_date, created_by, last_update_login) ' ||
' with dem_dates as '||
' (SELECT datet, num_of_days, ' || x_start_date || x_end_date ||
' FROM ' || x_source_time_table || ') ' ||
' select start_date + i day_date, datet, start_date, end_date, sysdate, :1, sysdate, :2, :3 ' ||
' from dem_dates, xmltable(''for $i in 0 to xs:int(D)-1 return $i'' passing xmlelement(d, num_of_days)
columns i integer path ''.'')' ;
msd_dem_common_utilities.log_debug('SQL for inserting data into destination msd_dem_day_dates : ');
x_sql := 'DELETE FROM msd_dem_day_dates' || g_dblink;
msd_dem_common_utilities.log_message('Inserting data into source msd_dem_day_dates');
x_sql := 'INSERT INTO msd_dem_day_dates' || g_dblink ||
' (day_date, bucket_date, bucket_start_date, bucket_end_date, last_update_date, last_updated_by, creation_date, created_by, last_update_login) ' ||
' SELECT day_date, bucket_date, bucket_start_date, bucket_end_date, ' ||
' sysdate, :1, sysdate, :2, :3 ' ||
' FROM msd_dem_day_dates' ;
msd_dem_common_utilities.log_debug('SQL for inserting data into source msd_dem_day_dates : ');
SELECT owner
FROM dba_objects
WHERE owner = owner
AND object_type = 'TABLE'
AND object_name = 'MDP_MATRIX'
ORDER BY created desc;
* This procedure updates profiles values configure for a particular legacy instance
* to the legacy profiles table - MSD_DEM_LEGACY_SETUP_PARAMS
*/
PROCEDURE CONFIGURE_LEGACY_PROFILES (
errbuf OUT NOCOPY VARCHAR2,
retcode OUT NOCOPY VARCHAR2,
p_legacy_instance_id IN NUMBER,
p_master_org IN NUMBER,
p_sr_category_set_id IN NUMBER)
IS
/*** LOCAL VARIABLES ***/
x_sql VARCHAR2(500) := NULL;
/* Before inserting parameter values for a legacy instance to the MSD_DEM_LEGACY_SETUP_PARAMS table
* delete any rows which already exist for this instance.
*/
msd_dem_common_utilities.log_message ('Deleting records from msd_dem_legacy_setup_params, for instance_id : ' || p_legacy_instance_id );
x_sql := 'DELETE FROM msd_dem_legacy_setup_params where instance_id = ' || p_legacy_instance_id;
/* Insert values for the two parameters
* MSD_DEM_MASTER_ORG and MSD_DEM_CATEGORY_SET_NAME
* into MSD_DEM_LEGACY_SETUP_PARAMS table
*/
x_sql := 'INSERT INTO msd_dem_legacy_setup_params' ||
' (instance_id, parameter_name, parameter_value, last_update_date, last_updated_by, creation_date, ' ||
' created_by, last_update_login) values (:1, :2, :3, sysdate, :4, sysdate, ' ||
' :5, :6)';
msd_dem_common_utilities.log_message ('Inserting profile ' || g_master_org || ' for legacy instance ' || p_legacy_instance_id || ' into msd_dem_legacy_setup_params');
msd_dem_common_utilities.log_message ('Inserting profile ' || g_sr_category_set || ' for legacy instance ' || p_legacy_instance_id || ' into msd_dem_legacy_setup_params');
x_sql := 'SELECT parameter_value FROM msd_dem_legacy_setup_params where instance_id = :1 and parameter_name = :2';
x_sql := 'DELETE FROM msd_dem_setup_parameters where parameter_name in (''' || g_master_org || ''', ''' || g_sr_category_set || ''')';
/* Insert values for the two profiles
* MSD_DEM_MASTER_ORG and MSD_DEM_CATEGORY_SET_NAME
* into MSD_DEM_SETUP_PARAMETERS table
*/
x_sql := 'INSERT INTO msd_dem_setup_parameters' ||
' (parameter_name, parameter_value, last_update_date, last_updated_by, creation_date, ' ||
' created_by, last_update_login) values (:1, :2, sysdate, :3, sysdate, ' ||
' :4, :5)';
msd_dem_common_utilities.log_message ('Inserting profile ' || g_master_org || ' into msd_dem_setup_parameters');
msd_dem_common_utilities.log_message ('Inserting profile ' || g_sr_category_set || ' into msd_dem_setup_parameters');