The following lines contain the word 'select', 'insert', 'update' or 'delete':
p_update_only in boolean default FALSE,
p_insert_only in boolean default FALSE,
p_level_value2 in varchar2 default NULL)
IS
old_pv_rec fnd_profile_option_values%rowtype;
update_flag varchar2(1);
insert_flag varchar2(1);
select *
into old_pv_rec
from fnd_profile_option_values
where (application_id, profile_option_id) in (
select application_id, profile_option_id
from fnd_profile_options
where application_id = p_application_id
and profile_option_name = p_profile_option_name)
and level_id = p_level_id;
select *
into old_pv_rec
from fnd_profile_option_values
where (application_id, profile_option_id) in (
select application_id, profile_option_id
from fnd_profile_options
where application_id = p_application_id
and profile_option_name = p_profile_option_name)
and level_id = p_level_id
and level_value = p_level_value
and level_value2 = p_level_value2;
select tname into tablename from tab where tname ='ADX_PRE_AUTOCONFIG' and tabtype in ('TABLE', 'SYNONYM');
update_only varchar2(1),
insert_only varchar2(1),
level_value2 varchar2(100)
)';
select column_name into columnname from user_tab_columns where table_name like 'ADX_PRE_AUTOCONFIG' and column_name like 'LEVEL_VALUE2';
if (p_insert_only = FALSE) then
insert_flag := 'F';
if (p_update_only = FALSE)then
update_flag := 'F';
update_flag := 'T';
insert_flag := 'T';
if (p_update_only = FALSE) then
update_flag := 'F';
update_flag := 'T';
str := 'select count(*)
from ADX_PRE_AUTOCONFIG where
application_id=:1 and
profile_option_name=:2 and
level_id=:3 and
level_value=:4 and
context_name=:5 and
update_only= :6 and
insert_only= :7';
p_level_value, p_context_name,update_flag,insert_flag;
if (countrow>0) then -- update table since row already exist
str := 'update ADX_PRE_AUTOCONFIG set
profile_value=:1 where
application_id=:2 and profile_option_name=:3 and
level_id=:4 and level_value=:5 and
context_name=:6 and update_only=:7 and
insert_only=:8';
p_context_name, update_flag, insert_flag;
else -- insert new row into table since one does not exist yet
str:='insert into ADX_PRE_AUTOCONFIG
(application_id, profile_option_name,
level_id,level_value,profile_value,
level_value_app_id,context_name,
update_only,insert_only)
values(:1, :2, :3, :4, :5, :6, :7, :8, :9)';
level_value_app_id_temp, p_context_name, update_flag,
insert_flag;
str:= 'select count(*)
from ADX_PRE_AUTOCONFIG where
application_id=:1 and
profile_option_name=:2 and
level_id=:3 and
level_value=:4 and
level_value_app_id=:5 and
context_name=:6 and
update_only= :7 and
insert_only= :8 and
level_value2= :9';
update_flag,insert_flag, p_level_value2;
if (countrow>0) then -- update table since row already exist
str := 'update ADX_PRE_AUTOCONFIG set
profile_value=:1 where
application_id=:2 and profile_option_name=:3 and
level_id=:4 and level_value=:5 and
level_value_app_id=:6 and
context_name=:7 and update_only=:8 and
insert_only=:9 and level_value2=:10';
level_value_app_id_temp, p_context_name, update_flag,
insert_flag, p_level_value2;
else -- insert new row into table since one does not exist yet
str:='insert into ADX_PRE_AUTOCONFIG
values(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10)';
level_value_app_id_temp, p_context_name, update_flag,
insert_flag, p_level_value2;
println(' INFO : Updated/created profile option value.');