The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
end_user_column_name,
flex_value_set_id
from fnd_descr_flex_column_usages cu
where cu.descriptive_flexfield_name = cpv_flex_name
and cu.descriptive_flex_context_code = cpv_context
and application_id = cpn_application_id;
select flex_value_set_name
from fnd_flex_value_sets
where flex_value_set_id = cpn_value_set_id;
select application_id
from fnd_application
where application_short_name = cpv_app_short_name;
select descriptive_flex_context_code,
application_column_name,
flex_value_set_id
from fnd_descr_flex_column_usages
where application_id = cpn_application_id
and descriptive_flexfield_name = 'AP_INVOICES'
and end_user_column_name = p_segment_name;
FUNCTION check_before_delete_dff(pv_flexfield_name VARCHAR2,
pv_context VARCHAR2)
RETURN VARCHAR2
IS
CURSOR c_flex
IS
SELECT application_table_name,
context_column_name
FROM fnd_descriptive_flexs
WHERE descriptive_flexfield_name = pv_flexfield_name;
lv_sql := 'SELECT /*+ parallel(e) */ ''1'' from '||r_flex.application_table_name||'e WHERE '||r_flex.context_column_name||' = :a AND rownum < 2' ;
END check_before_delete_dff;
procedure delete_context is
lv_flag VARCHAR2(1);
lv_flag := check_before_delete_dff(pv_flexfield_name => lv_flexfield_name,
pv_context => lv_context);
/* Delete ValueSets */
for rec_segment in cur_segment(ln_application_id, lv_flexfield_name, lv_context) loop
fnd_flex_dsc_api.delete_segment
(
appl_short_name => lv_appl_short_name,
flexfield_name => lv_flexfield_name ,
context => lv_context ,
segment => rec_segment.end_user_column_name
);
fnd_flex_val_api.delete_valueset(lv_value_set_name);
/* Delete Context */
fnd_flex_dsc_api.delete_context (
appl_short_name => lv_appl_short_name ,
flexfield_name => lv_flexfield_name ,
context => lv_context
);
end delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
delete_context;
select application_id into ln_application_id
from fnd_application
where application_short_name = 'SQLAP';
lv_flag := check_before_delete_dff(pv_flexfield_name => 'AP_INVOICES',
pv_context => lv_context);
fnd_flex_dsc_api.delete_segment
(
appl_short_name => 'SQLAP',
flexfield_name => 'AP_INVOICES',
context => lv_context,
segment => lv_attribute_vat_invoice
);
fnd_flex_val_api.delete_valueset(lv_value_set_inv_name);
fnd_flex_dsc_api.delete_segment
(
appl_short_name => 'SQLAP',
flexfield_name => 'AP_INVOICES',
context => lv_context,
segment => lv_attribute_vat_date
);
fnd_flex_val_api.delete_valueset(lv_value_set_date_name);
fnd_flex_dsc_api.delete_segment
(
appl_short_name => 'SQLAP',
flexfield_name => 'AP_INVOICES',
context => lv_context,
segment => lv_attribute_vat_receipt_date
);
fnd_flex_val_api.delete_valueset(lv_value_set_rdate_name);
fnd_flex_dsc_api.delete_context
(
appl_short_name => 'SQLAP' ,
flexfield_name => 'AP_INVOICES' ,
context => 'India VAT'
);