The following lines contain the word 'select', 'insert', 'update' or 'delete':
select count(*)
into l_tmp
from FND_PRIMARY_KEYS
where APPLICATION_ID = x_application_id
and TABLE_ID = x_table_id
and PRIMARY_KEY_NAME <> upper(x_primary_key_name)
and PRIMARY_KEY_TYPE = 'D';
select P.APPLICATION_ID, P.TABLE_ID, P.PRIMARY_KEY_ID
into x_pk_application_id, x_pk_table_id, x_pk_id
from FND_PRIMARY_KEYS P,
FND_TABLES T,
FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name
and A.APPLICATION_ID = T.APPLICATION_ID
and T.TABLE_NAME = x_table_name
and T.TABLE_ID = P.TABLE_ID
and T.APPLICATION_ID = P.APPLICATION_ID
and P.PRIMARY_KEY_NAME = upper(x_primary_key_name);
update FND_COLUMNS
set USER_COLUMN_NAME = '@'||USER_COLUMN_NAME
where APPLICATION_ID = x_application_id
and TABLE_ID = x_table_id
and COLUMN_NAME <> x_column_name
and USER_COLUMN_NAME = x_user_column_name;
select max(column_sequence)
into maxseq
from FND_COLUMNS
where APPLICATION_ID = x_application_id
and TABLE_ID = x_table_id;
update FND_COLUMNS
set COLUMN_SEQUENCE = to_number('200001') + maxseq
where APPLICATION_ID = x_application_id
and TABLE_ID = x_table_id
and COLUMN_NAME <> x_column_name
and COLUMN_SEQUENCE = to_number(x_column_sequence);
procedure InsertTable (
x_application_id in number,
x_table_name in varchar2,
x_user_table_name in varchar2,
x_table_type in varchar2,
x_description in varchar2,
x_auto_size in varchar2,
x_initial_extent in varchar2,
x_next_extent in varchar2,
x_min_extents in varchar2,
x_max_extents in varchar2,
x_ini_trans in varchar2,
x_max_trans in varchar2,
x_pct_free in varchar2,
x_pct_increase in varchar2,
x_pct_used in varchar2,
x_hosted_support_style in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_TABLES (
APPLICATION_ID,
TABLE_ID,
TABLE_NAME,
USER_TABLE_NAME,
TABLE_TYPE,
DESCRIPTION,
AUTO_SIZE,
INITIAL_EXTENT,
NEXT_EXTENT,
MIN_EXTENTS,
MAX_EXTENTS,
INI_TRANS,
MAX_TRANS,
PCT_FREE,
PCT_INCREASE,
PCT_USED,
HOSTED_SUPPORT_STYLE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
x_application_id,
FND_TABLES_S.NEXTVAL,
x_table_name,
x_user_table_name,
x_table_type,
x_description,
x_auto_size,
x_initial_extent,
x_next_extent,
x_min_extents,
x_max_extents,
x_ini_trans,
x_max_trans,
x_pct_free,
x_pct_increase,
x_pct_used,
x_hosted_support_style,
x_last_updated_by,
x_last_update_date,
x_last_update_login,
x_last_update_date,
x_last_updated_by);
end InsertTable;
procedure InsertColumn (
x_application_id in number,
x_table_id in number,
x_column_name in varchar2,
x_user_column_name in varchar2,
x_column_sequence in varchar2,
x_column_type in varchar2,
x_width in varchar2,
x_null_allowed_flag in varchar2,
x_description in varchar2,
x_default_value in varchar2,
x_translate_flag in varchar2,
x_precision in varchar2,
x_scale in varchar2,
x_flexfield_usage_code in varchar2,
x_flexfield_application_id in varchar2,
x_flexfield_name in varchar2,
x_flex_value_set_app_id in varchar2,
x_flex_value_set_id in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_COLUMNS (
APPLICATION_ID,
TABLE_ID,
COLUMN_ID,
COLUMN_NAME,
USER_COLUMN_NAME,
COLUMN_SEQUENCE,
COLUMN_TYPE,
WIDTH,
NULL_ALLOWED_FLAG,
DESCRIPTION,
DEFAULT_VALUE,
TRANSLATE_FLAG,
PRECISION,
SCALE,
FLEXFIELD_USAGE_CODE,
FLEXFIELD_APPLICATION_ID,
FLEXFIELD_NAME,
FLEX_VALUE_SET_APPLICATION_ID,
FLEX_VALUE_SET_ID,
CREATION_DATE,
CREATED_BY,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN)
values (
x_application_id,
x_table_id,
FND_COLUMNS_S.NEXTVAL,
x_column_name,
x_user_column_name,
x_column_sequence,
x_column_type,
x_width,
x_null_allowed_flag,
x_description,
x_default_value,
x_translate_flag,
x_precision,
x_scale,
x_flexfield_usage_code,
x_flexfield_application_id,
x_flexfield_name,
x_flex_value_set_app_id,
x_flex_value_set_id,
x_last_update_date,
x_last_updated_by,
x_last_updated_by,
x_last_update_date,
x_last_update_login);
end InsertColumn;
procedure InsertIndex (
x_application_id in number,
x_table_id in number,
x_index_name in varchar2,
x_uniqueness in varchar2,
x_auto_size in varchar2,
x_description in varchar2,
x_initial_extent in varchar2,
x_next_extent in varchar2,
x_min_extents in varchar2,
x_max_extents in varchar2,
x_ini_trans in varchar2,
x_max_trans in varchar2,
x_pct_free in varchar2,
x_pct_increase in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_INDEXES (
APPLICATION_ID,
TABLE_ID,
INDEX_ID,
INDEX_NAME,
UNIQUENESS,
AUTO_SIZE,
DESCRIPTION,
INITIAL_EXTENT,
NEXT_EXTENT,
MIN_EXTENTS,
MAX_EXTENTS,
INI_TRANS,
MAX_TRANS,
PCT_FREE,
PCT_INCREASE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
x_application_id,
x_table_id,
FND_INDEXES_S.NEXTVAL,
x_index_name,
x_uniqueness,
x_auto_size,
x_description,
x_initial_extent,
x_next_extent,
x_min_extents,
x_max_extents,
x_ini_trans,
x_max_trans,
x_pct_free,
x_pct_increase,
x_last_updated_by,
x_last_update_date,
x_last_update_login,
x_last_update_date,
x_last_updated_by);
end InsertIndex;
procedure InsertPrimaryKey(
x_application_id in number,
x_table_id in number,
x_primary_key_name in varchar2,
x_primary_key_type in varchar2,
x_audit_key_flag in varchar2,
x_enabled_flag in varchar2,
x_description in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_PRIMARY_KEYS(
APPLICATION_ID,
TABLE_ID,
PRIMARY_KEY_NAME,
PRIMARY_KEY_ID,
PRIMARY_KEY_TYPE,
AUDIT_KEY_FLAG,
ENABLED_FLAG,
DESCRIPTION,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
x_application_id,
x_table_id,
x_primary_key_name,
FND_PRIMARY_KEYS_S.NEXTVAL,
x_primary_key_type,
x_audit_key_flag,
x_enabled_flag,
x_description,
x_last_updated_by,
x_last_update_date,
x_last_update_login,
x_last_update_date,
x_last_updated_by);
end InsertPrimaryKey;
procedure InsertForeignKey(
x_application_id in number,
x_table_id in number,
x_foreign_key_name in varchar2,
x_primary_key_application_id in number,
x_primary_key_table_id in number,
x_primary_key_id in number,
x_description in varchar2,
x_cascade_behavior in varchar2,
x_foreign_key_relation in varchar2,
x_condition in varchar2,
x_enabled_flag in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_FOREIGN_KEYS(
APPLICATION_ID,
TABLE_ID,
FOREIGN_KEY_ID,
FOREIGN_KEY_NAME,
PRIMARY_KEY_APPLICATION_ID,
PRIMARY_KEY_TABLE_ID,
PRIMARY_KEY_ID,
DESCRIPTION,
CASCADE_BEHAVIOR,
FOREIGN_KEY_RELATION,
CONDITION,
ENABLED_FLAG,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
x_application_id,
x_table_id,
FND_FOREIGN_KEYS_S.NEXTVAL,
x_foreign_key_name,
x_primary_key_application_id,
x_primary_key_table_id,
x_primary_key_id,
x_description,
x_cascade_behavior,
x_foreign_key_relation,
x_condition,
x_enabled_flag,
x_last_updated_by,
x_last_update_date,
x_last_update_login,
x_last_update_date,
x_last_updated_by);
end InsertForeignKey;
procedure InsertSequence (
x_application_id in number,
x_sequence_name in varchar2,
x_start_value in varchar2,
x_description in varchar2,
x_increment_by in varchar2,
x_min_value in varchar2,
x_max_value in varchar2,
x_cache_size in varchar2,
x_cycle_flag in varchar2,
x_order_flag in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_SEQUENCES (
APPLICATION_ID,
SEQUENCE_ID,
SEQUENCE_NAME,
START_VALUE,
DESCRIPTION,
INCREMENT_BY,
MIN_VALUE,
MAX_VALUE,
CACHE_SIZE,
CYCLE_FLAG,
ORDER_FLAG,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
x_application_id,
FND_SEQUENCES_S.NEXTVAL,
x_sequence_name,
x_start_value,
x_description,
x_increment_by,
x_min_value,
x_max_value,
x_cache_size,
x_cycle_flag,
x_order_flag,
x_last_updated_by,
x_last_update_date,
x_last_update_login,
x_last_update_date,
x_last_updated_by);
end InsertSequence;
procedure InsertView (
x_application_id in number,
x_view_name in varchar2,
x_text in varchar2,
x_description in varchar2,
x_creation_date in date,
x_created_by in number,
x_last_update_date in date,
x_last_updated_by in number,
x_last_update_login in number
) is
begin
insert into FND_VIEWS (
APPLICATION_ID,
VIEW_ID,
VIEW_NAME,
TEXT,
DESCRIPTION,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
x_application_id,
FND_VIEWS_S.NEXTVAL,
x_view_name,
x_text,
x_description,
x_last_updated_by,
x_last_update_date,
x_last_update_login,
x_last_update_date,
x_last_updated_by);
end InsertView;
x_last_update_date => null);
x_last_update_date => null);
x_last_update_date => null);
x_last_update_date => null,
x_phase_mode => 'BEGIN');
x_last_update_date => null,
x_phase_mode => 'END');
x_last_update_date => null);
x_last_update_date => null,
x_phase_mode => 'BEGIN');
x_last_update_date => null,
x_phase_mode => 'END');
x_last_update_date => null);
x_last_update_date => null,
x_phase_mode => 'BEGIN');
x_last_update_date => null,
x_phase_mode => 'END');
x_last_update_date => null);
x_last_update_date => null);
x_last_update_date => null,
x_phase_mode => 'BEGIN');
x_last_update_date => null,
x_phase_mode => 'END');
x_last_update_date => null);
for r in (select text from fnd_views
where application_id = x_application_id
and view_name = x_view_name) loop
len := length(r.text);
select text
into vtext
from fnd_views
where application_id = x_application_id
and view_name = x_view_name;
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
select table_id
into tab_id
from fnd_tables
where application_id = appl_id
and table_name = upper(x_table_name);
select column_id
into col_id
from fnd_columns
where application_id = appl_id
and table_id = tab_id
and column_name = upper(x_column_name);
select count(*) into cnt
from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and column_id = col_id;
select count(*) into cnt
from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and column_id = col_id;
select count(*) into cnt
from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and column_id = col_id;
delete from fnd_columns
where application_id = appl_id
and table_id = tab_id
and column_id = col_id;
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
select table_id
into tab_id
from fnd_tables
where application_id = appl_id
and table_name = upper(x_table_name);
select index_id
into ind_id
from fnd_indexes
where application_id = appl_id
and table_id = tab_id
and index_name = upper(x_index_name);
delete from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id;
delete from fnd_indexes
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id;
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
select table_id
into tab_id
from fnd_tables
where application_id = appl_id
and table_name = upper(x_table_name);
select primary_key_id
into pk_id
from fnd_primary_keys
where application_id = appl_id
and table_id = tab_id
and primary_key_name = upper(x_primary_key_name);
select count(*) into cnt
from fnd_foreign_keys
where primary_key_application_id = appl_id
and primary_key_table_id = tab_id
and primary_key_id = pk_id;
delete from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id;
delete from fnd_primary_keys
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id;
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
select table_id
into tab_id
from fnd_tables
where application_id = appl_id
and table_name = upper(x_table_name);
select foreign_key_id
into fk_id
from fnd_foreign_keys
where application_id = appl_id
and table_id = tab_id
and foreign_key_name = upper(x_foreign_key_name);
delete from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id;
delete from fnd_foreign_keys
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id;
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
delete from fnd_sequences
where application_id = appl_id
and sequence_name = upper(x_sequence_name);
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
select view_id into vw_id
from fnd_views
where application_id = appl_id
and view_name = upper(x_view_name);
delete from fnd_view_columns
where application_id = appl_id
and view_id = vw_id;
delete from fnd_views
where application_id = appl_id
and view_id = vw_id;
select index_name
from fnd_indexes
where application_id = appl_id
and table_id = tab_id;
select foreign_key_name
from fnd_foreign_keys
where application_id = appl_id
and table_id = tab_id;
select primary_key_name
from fnd_primary_keys
where application_id = appl_id
and table_id = tab_id;
select application_id
into appl_id
from fnd_application
where application_short_name = upper(x_application_short_name);
select table_id
into tab_id
from fnd_tables
where application_id = appl_id
and table_name = upper(x_table_name);
delete from fnd_columns
where application_id = appl_id
and table_id = tab_id;
delete from fnd_tables
where application_id = appl_id
and table_id = tab_id;
x_last_update_date in varchar2
) is
appl_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select 'X' into dummy
from fnd_lookups
where lookup_type = 'HOSTED_SUPPORT_STYLE'
and lookup_code = x_hosted_support_style;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_TABLES
where APPLICATION_ID = appl_id
and TABLE_NAME = x_table_name;
update FND_TABLES
set USER_TABLE_NAME = '@'||USER_TABLE_NAME
where APPLICATION_ID = appl_id
and TABLE_NAME <> x_table_name
and USER_TABLE_NAME = x_user_table_name;
update FND_TABLES set
USER_TABLE_NAME = x_user_table_name,
TABLE_TYPE = x_table_type,
DESCRIPTION = x_description,
AUTO_SIZE = x_auto_size,
INITIAL_EXTENT = x_initial_extent,
NEXT_EXTENT = x_next_extent,
MIN_EXTENTS = x_min_extents,
MAX_EXTENTS = x_max_extents,
INI_TRANS = x_ini_trans,
MAX_TRANS = x_max_trans,
PCT_FREE = x_pct_free,
PCT_INCREASE = x_pct_increase,
PCT_USED = x_pct_used,
HOSTED_SUPPORT_STYLE = x_hosted_support_style,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and TABLE_NAME = x_table_name;
Fnd_Dictionary_Pkg.InsertTable(
appl_id,
x_table_name,
x_user_table_name,
x_table_type,
x_description,
x_auto_size,
x_initial_extent,
x_next_extent,
x_min_extents,
x_max_extents,
x_ini_trans,
x_max_trans,
x_pct_free,
x_pct_increase,
x_pct_used,
x_hosted_support_style,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
x_last_update_date in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_COLUMNS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and COLUMN_NAME = x_column_name;
update FND_COLUMNS set
USER_COLUMN_NAME = x_user_column_name,
COLUMN_SEQUENCE = x_column_sequence,
COLUMN_TYPE = x_column_type,
WIDTH = x_width,
NULL_ALLOWED_FLAG = x_null_allowed_flag,
DESCRIPTION = x_description,
DEFAULT_VALUE = x_default_value,
TRANSLATE_FLAG = x_translate_flag,
PRECISION = x_precision,
SCALE = x_scale,
FLEXFIELD_USAGE_CODE = x_flexfield_usage_code,
FLEXFIELD_APPLICATION_ID = x_flexfield_application_id,
FLEXFIELD_NAME = x_flexfield_name,
FLEX_VALUE_SET_APPLICATION_ID = x_flex_value_set_app_id,
FLEX_VALUE_SET_ID = x_flex_value_set_id,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and COLUMN_NAME = x_column_name;
Fnd_Dictionary_Pkg.InsertColumn(
appl_id,
tab_id,
x_column_name,
x_user_column_name,
x_column_sequence,
x_column_type,
x_width,
x_null_allowed_flag,
x_description,
x_default_value,
x_translate_flag,
x_precision,
x_scale,
x_flexfield_usage_code,
x_flexfield_application_id,
x_flexfield_name,
x_flex_value_set_app_id,
x_flex_value_set_id,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
x_last_update_date in varchar2
) is
appl_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_HISTOGRAM_COLS
where APPLICATION_ID = appl_id
and TABLE_NAME = x_table_name
and COLUMN_NAME = x_column_name;
update FND_HISTOGRAM_COLS set
PARTITION = x_partition,
HSIZE = x_hsize,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and TABLE_NAME = x_table_name
and COLUMN_NAME = x_column_name;
insert into FND_HISTOGRAM_COLS (
APPLICATION_ID,
TABLE_NAME,
COLUMN_NAME,
PARTITION,
HSIZE,
CREATION_DATE,
CREATED_BY,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN)
values (
appl_id,
x_table_name,
x_column_name,
x_partition,
x_hsize,
f_ludate,
f_luby,
f_luby,
f_ludate,
f_luby);
x_last_update_date in varchar2,
x_phase_mode in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
child_file_ludate date; -- child entity update date in file
child_db_ludate date; -- child update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select INDEX_ID
into ind_id
from FND_INDEXES
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_NAME = x_index_name;
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_INDEXES
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_NAME = x_index_name;
update FND_INDEXES set
UNIQUENESS = x_uniqueness,
AUTO_SIZE = x_auto_size,
DESCRIPTION = x_description,
INITIAL_EXTENT = x_initial_extent,
NEXT_EXTENT = x_next_extent,
MIN_EXTENTS = x_min_extents,
MAX_EXTENTS = x_max_extents,
INI_TRANS = x_ini_trans,
MAX_TRANS = x_max_trans,
PCT_FREE = x_pct_free,
PCT_INCREASE = x_pct_increase,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_NAME = x_index_name;
delete from FND_INDEX_COLUMNS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id
and COLUMN_ID < 0;
update FND_INDEX_COLUMNS
set COLUMN_SEQUENCE = -1 * COLUMN_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id;
update FND_INDEX_COLUMNS
set COLUMN_SEQUENCE = -1000
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id
and COLUMN_SEQUENCE = 0;
Fnd_Dictionary_Pkg.InsertIndex(
appl_id,
tab_id,
x_index_name,
x_uniqueness,
x_auto_size,
x_description,
x_initial_extent,
x_next_extent,
x_min_extents,
x_max_extents,
x_ini_trans,
x_max_trans,
x_pct_free,
x_pct_increase,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
select INDEX_ID
into ind_id
from FND_INDEXES
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_NAME = x_index_name;
select max(last_update_date)
into child_db_ludate
from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id
and column_sequence < 0
and column_id < 0;
select max(last_update_date)
into child_file_ludate
from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id
and column_sequence >= 0
and column_id > 0;
select max(-1)
into child_db_luby
from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id
and column_sequence < 0
and column_id < 0
and last_updated_by not in (0,1,2);
select max(-1)
into child_file_luby
from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id
and column_sequence > 0
and column_id > 0
and last_updated_by not in (0,1,2);
delete from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id
and column_sequence < 0
and column_id < 0;
delete from fnd_index_columns
where application_id = appl_id
and table_id = tab_id
and index_id = ind_id
and column_sequence >= 0
and column_id > 0;
update FND_INDEX_COLUMNS
set COLUMN_SEQUENCE = -1 * COLUMN_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id;
update FND_INDEX_COLUMNS
set COLUMN_SEQUENCE = 0
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id
and COLUMN_SEQUENCE = 1000;
update FND_INDEX_COLUMNS
set COLUMN_SEQUENCE = -1 * COLUMN_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id;
update FND_INDEX_COLUMNS
set COLUMN_SEQUENCE = 0
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and INDEX_ID = ind_id
and COLUMN_SEQUENCE = 1000;
x_last_update_date in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
select I.INDEX_ID into idx_id from FND_INDEXES I
where I.APPLICATION_ID = appl_id
and I.TABLE_ID = tab_id
and I.INDEX_NAME = x_index_name;
select C.COLUMN_ID into col_id from FND_COLUMNS C
where C.APPLICATION_ID = appl_id
and C.TABLE_ID = tab_id
and C.COLUMN_NAME = x_index_column_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
insert into FND_INDEX_COLUMNS(
APPLICATION_ID,
TABLE_ID,
INDEX_ID,
COLUMN_ID,
COLUMN_SEQUENCE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
appl_id,
tab_id,
idx_id,
col_id,
x_index_column_sequence,
f_luby,
f_ludate,
f_luby,
f_ludate,
f_luby);
x_last_update_date in varchar2,
x_phase_mode in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
child_file_ludate date; -- child entity update date in file
child_db_ludate date; -- child update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
pkmode := 'INSERT';
pkmode := 'UPDATE';
if ((pkmode = 'INSERT' and x_primary_key_type not in ('S', 'D')) or
(pkmode = 'UPDATE' and nvl(x_primary_key_type, 'S') not in ('S', 'D'))) then
fnd_message.set_name('FND', 'FND-INVALID PRIMARY KEY ATTR');
if ((pkmode = 'INSERT' and x_audit_key_flag not in ('Y', 'N')) or
(pkmode = 'UPDATE' and nvl(x_audit_key_flag, 'Y') not in ('Y', 'N'))) then
fnd_message.set_name('FND', 'FND-INVALID PRIMARY KEY ATTR');
if ((pkmode = 'INSERT' and x_enabled_flag not in ('Y', 'N')) or
(pkmode = 'UPDATE' and nvl(x_enabled_flag, 'Y') not in ('Y', 'N'))) then
fnd_message.set_name('FND', 'FND-INVALID PRIMARY KEY ATTR');
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_PRIMARY_KEYS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_NAME = x_primary_key_name;
if (pkmode = 'UPDATE') then
if (fnd_load_util.upload_test(f_luby, f_ludate, db_luby,
db_ludate, X_CUSTOM_MODE)) then
update FND_PRIMARY_KEYS set
PRIMARY_KEY_TYPE = x_primary_key_type,
AUDIT_KEY_FLAG = x_audit_key_flag,
ENABLED_FLAG = x_enabled_flag,
DESCRIPTION = x_description,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_NAME = x_primary_key_name;
delete from FND_PRIMARY_KEY_COLUMNS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id
and COLUMN_ID < 0;
update FND_PRIMARY_KEY_COLUMNS
set PRIMARY_KEY_SEQUENCE = -1 * PRIMARY_KEY_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id;
update FND_PRIMARY_KEY_COLUMNS
set PRIMARY_KEY_SEQUENCE = -1000
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id
and PRIMARY_KEY_SEQUENCE = 0;
Fnd_Dictionary_Pkg.InsertPrimaryKey(
appl_id,
tab_id,
x_primary_key_name,
x_primary_key_type,
x_audit_key_flag,
x_enabled_flag,
x_description,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
Fnd_Dictionary_Pkg.InsertPrimaryKey(
appl_id,
tab_id,
x_primary_key_name,
x_primary_key_type,
x_audit_key_flag,
x_enabled_flag,
x_description,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
select max(last_update_date)
into child_db_ludate
from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id
and primary_key_sequence < 0
and column_id < 0;
select max(last_update_date)
into child_file_ludate
from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id
and PRIMARY_KEY_SEQUENCE >= 0
and column_id > 0;
select max(-1)
into child_db_luby
from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id
and PRIMARY_KEY_SEQUENCE < 0
and column_id < 0
and last_updated_by not in (0,1,2);
select max(-1)
into child_file_luby
from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id
and PRIMARY_KEY_SEQUENCE > 0
and column_id > 0
and last_updated_by not in (0,1,2);
delete from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id
and PRIMARY_KEY_SEQUENCE < 0
and column_id < 0;
delete from fnd_primary_key_columns
where application_id = appl_id
and table_id = tab_id
and primary_key_id = pk_id
and PRIMARY_KEY_SEQUENCE >= 0
and column_id > 0;
update FND_PRIMARY_KEY_COLUMNS
set PRIMARY_KEY_SEQUENCE = -1 * PRIMARY_KEY_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id;
update FND_PRIMARY_KEY_COLUMNS
set PRIMARY_KEY_SEQUENCE = 0
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id
and PRIMARY_KEY_SEQUENCE = 1000;
update FND_PRIMARY_KEY_COLUMNS
set PRIMARY_KEY_SEQUENCE = -1 * PRIMARY_KEY_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id;
update FND_PRIMARY_KEY_COLUMNS
set PRIMARY_KEY_SEQUENCE = 0
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and PRIMARY_KEY_ID = pk_id
and PRIMARY_KEY_SEQUENCE = 1000;
x_last_update_date in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
select P.PRIMARY_KEY_ID into pk_id from FND_PRIMARY_KEYS P
where P.APPLICATION_ID = appl_id
and P.TABLE_ID = tab_id
and P.PRIMARY_KEY_NAME = x_primary_key_name;
select C.COLUMN_ID into col_id from FND_COLUMNS C
where C.APPLICATION_ID = appl_id
and C.TABLE_ID = tab_id
and C.COLUMN_NAME = x_primary_key_column_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
insert into FND_PRIMARY_KEY_COLUMNS(
APPLICATION_ID,
TABLE_ID,
PRIMARY_KEY_ID,
COLUMN_ID,
PRIMARY_KEY_SEQUENCE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
appl_id,
tab_id,
pk_id,
col_id,
x_primary_key_column_sequence,
f_luby,
f_ludate,
f_luby,
f_ludate,
f_luby);
x_last_update_date in varchar2,
x_phase_mode in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
child_file_ludate date; -- child entity update date in file
child_db_ludate date; -- child update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select FOREIGN_KEY_ID
into fk_id
from FND_FOREIGN_KEYS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_NAME = x_foreign_key_name;
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_FOREIGN_KEYS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_NAME = x_foreign_key_name;
update FND_FOREIGN_KEYS set
PRIMARY_KEY_APPLICATION_ID = pk_appl_id,
PRIMARY_KEY_TABLE_ID = pk_tab_id,
PRIMARY_KEY_ID = pk_id,
CASCADE_BEHAVIOR = x_cascade_behavior,
FOREIGN_KEY_RELATION = x_foreign_key_relation,
DESCRIPTION = x_description,
CONDITION = x_condition,
ENABLED_FLAG = x_enabled_flag,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_NAME = x_foreign_key_name;
delete from FND_FOREIGN_KEY_COLUMNS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id
and COLUMN_ID < 0;
update FND_FOREIGN_KEY_COLUMNS
set FOREIGN_KEY_SEQUENCE = -1 * FOREIGN_KEY_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id;
update FND_FOREIGN_KEY_COLUMNS
set FOREIGN_KEY_SEQUENCE = -1000
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id
and FOREIGN_KEY_SEQUENCE = 0;
Fnd_Dictionary_Pkg.InsertForeignKey(
appl_id,
tab_id,
x_foreign_key_name,
pk_appl_id,
pk_tab_id,
pk_id,
x_description,
x_cascade_behavior,
x_foreign_key_relation,
x_condition,
x_enabled_flag,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
select FOREIGN_KEY_ID
into fk_id
from FND_FOREIGN_KEYS
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_NAME = x_foreign_key_name;
select max(last_update_date)
into child_db_ludate
from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id
and foreign_key_sequence < 0
and column_id < 0;
select max(last_update_date)
into child_file_ludate
from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id
and foreign_key_sequence >= 0
and column_id > 0;
select max(-1)
into child_db_luby
from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id
and foreign_key_sequence < 0
and column_id < 0
and last_updated_by not in (0,1,2);
select max(-1)
into child_file_luby
from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id
and foreign_key_sequence > 0
and column_id > 0
and last_updated_by not in (0,1,2);
delete from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id
and foreign_key_sequence < 0
and column_id < 0;
delete from fnd_foreign_key_columns
where application_id = appl_id
and table_id = tab_id
and foreign_key_id = fk_id
and foreign_key_sequence >= 0
and column_id > 0;
update FND_FOREIGN_KEY_COLUMNS
set FOREIGN_KEY_SEQUENCE = -1 * FOREIGN_KEY_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id;
update FND_FOREIGN_KEY_COLUMNS
set FOREIGN_KEY_SEQUENCE = 0
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id
and FOREIGN_KEY_SEQUENCE = 1000;
update FND_FOREIGN_KEY_COLUMNS
set FOREIGN_KEY_SEQUENCE = -1 * FOREIGN_KEY_SEQUENCE,
COLUMN_ID = -1 * COLUMN_ID
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id;
update FND_FOREIGN_KEY_COLUMNS
set FOREIGN_KEY_SEQUENCE = 0
where APPLICATION_ID = appl_id
and TABLE_ID = tab_id
and FOREIGN_KEY_ID = fk_id
and FOREIGN_KEY_SEQUENCE = 1000;
x_last_update_date in varchar2
) is
tab_id number;
f_ludate date; -- entity update date in file
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select T.TABLE_ID into tab_id from FND_TABLES T
where T.APPLICATION_ID = appl_id
and T.TABLE_NAME = x_table_name;
select F.FOREIGN_KEY_ID into fk_id from FND_FOREIGN_KEYS F
where F.APPLICATION_ID = appl_id
and F.TABLE_ID = tab_id
and F.FOREIGN_KEY_NAME = x_foreign_key_name;
select C.COLUMN_ID into col_id from FND_COLUMNS C
where C.APPLICATION_ID = appl_id
and C.TABLE_ID = tab_id
and C.COLUMN_NAME = x_foreign_key_column_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
insert into FND_FOREIGN_KEY_COLUMNS(
APPLICATION_ID,
TABLE_ID,
FOREIGN_KEY_ID,
COLUMN_ID,
FOREIGN_KEY_SEQUENCE,
CASCADE_VALUE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
appl_id,
tab_id,
fk_id,
col_id,
x_foreign_key_column_sequence,
x_cascade_value,
f_luby,
f_ludate,
f_luby,
f_ludate,
f_luby);
x_last_update_date in varchar2
) is
appl_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_SEQUENCES
where APPLICATION_ID = appl_id
and SEQUENCE_NAME = x_sequence_name;
update FND_SEQUENCES set
START_VALUE = x_start_value,
DESCRIPTION = x_description,
INCREMENT_BY = x_increment_by,
MIN_VALUE = x_min_value,
MAX_VALUE = x_max_value,
CACHE_SIZE = x_cache_size,
CYCLE_FLAG = x_cycle_flag,
ORDER_FLAG = x_order_flag,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and SEQUENCE_NAME = x_sequence_name;
Fnd_Dictionary_Pkg.InsertSequence(
appl_id,
x_sequence_name,
x_start_value,
x_description,
x_increment_by,
x_min_value,
x_max_value,
x_cache_size,
x_cycle_flag,
x_order_flag,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
x_last_update_date in varchar2,
x_phase_mode in varchar2
) is
appl_id number;
f_ludate date; -- entity update date in file
db_ludate date; -- entity update date in db
child_file_ludate date; -- child entity update date in file
child_db_ludate date; -- child update date in db
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
select VIEW_ID
into vw_id
from fnd_views
where application_id = appl_id
and VIEW_NAME = x_view_name;
select LAST_UPDATED_BY, LAST_UPDATE_DATE
into db_luby, db_ludate
from FND_VIEWS
where APPLICATION_ID = appl_id
and VIEW_NAME = x_view_name;
update FND_VIEWS set
TEXT = x_text,
DESCRIPTION = x_description,
LAST_UPDATED_BY = f_luby,
LAST_UPDATE_DATE = f_ludate,
LAST_UPDATE_LOGIN = f_luby
where APPLICATION_ID = appl_id
and VIEW_NAME = x_view_name;
update FND_VIEW_COLUMNS
set COLUMN_SEQUENCE = -1 * COLUMN_SEQUENCE,
COLUMN_NAME = decode(instr(COLUMN_NAME,'_'),0,concat('#',COLUMN_NAME),
replace(COLUMN_NAME, '_','#'))
where APPLICATION_ID = appl_id
and VIEW_ID = vw_id;
Fnd_Dictionary_Pkg.InsertView(
appl_id,
x_view_name,
x_text,
x_description,
f_ludate,
f_luby,
f_ludate,
f_luby,
0);
select VIEW_ID
into vw_id
from fnd_views
where application_id = appl_id
and VIEW_NAME = x_view_name;
select max(last_update_date)
into child_db_ludate
from fnd_view_columns
where application_id = appl_id
and VIEW_ID = vw_id
and column_sequence < 0;
select max(last_update_date)
into child_file_ludate
from fnd_view_columns
where application_id = appl_id
and VIEW_ID = vw_id
and column_sequence > 0;
select max(-1)
into child_db_luby
from fnd_view_columns
where application_id = appl_id
and VIEW_ID = vw_id
and column_sequence < 0
and last_updated_by not in (0,1,2);
select max(-1)
into child_file_luby
from fnd_view_columns
where application_id = appl_id
and VIEW_ID = vw_id
and column_sequence > 0
and last_updated_by not in (0,1,2);
delete from fnd_view_columns
where application_id = appl_id
and VIEW_ID = vw_id
and column_sequence < 0;
delete from fnd_view_columns
where application_id = appl_id
and VIEW_ID = vw_id
and column_sequence > 0;
update FND_VIEW_COLUMNS
set COLUMN_SEQUENCE = -1 * COLUMN_SEQUENCE,
COLUMN_NAME = decode(instr(COLUMN_NAME, '#'),1,ltrim(COLUMN_NAME, '#'),
replace(COLUMN_NAME, '#','_'))
where APPLICATION_ID = appl_id
and VIEW_ID = vw_id;
update FND_VIEW_COLUMNS
set COLUMN_SEQUENCE = -1 * COLUMN_SEQUENCE,
COLUMN_NAME = decode(instr(COLUMN_NAME, '#'),1,ltrim(COLUMN_NAME, '#'),
replace(COLUMN_NAME, '#','_'))
where APPLICATION_ID = appl_id
and VIEW_ID = vw_id;
x_last_update_date in varchar2
) is
appl_id number;
f_ludate date; -- entity update date in file
select A.APPLICATION_ID
into appl_id
from FND_APPLICATION A
where A.APPLICATION_SHORT_NAME = x_application_short_name;
select V.VIEW_ID into vw_id from FND_VIEWS V
where V.APPLICATION_ID = appl_id
and V.VIEW_NAME = x_view_name;
f_ludate := nvl(to_date(x_last_update_date, 'YYYY/MM/DD'), sysdate);
insert into FND_VIEW_COLUMNS(
APPLICATION_ID,
VIEW_ID,
COLUMN_SEQUENCE,
COLUMN_NAME,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN,
CREATION_DATE,
CREATED_BY)
values (
appl_id,
vw_id,
x_view_column_sequence,
x_view_column_name,
f_luby,
f_ludate,
f_luby,
f_ludate,
f_luby);
function UpdateOrCheckChildren(x_application_id in number,
x_primary_table_id in number,
x_primary_key_id in number,
x_col_sequences in NumberArrayTyp,
x_primary_key_col_value_old in NameArrayTyp,
x_primary_key_col_value_new in NameArrayTyp)
return boolean is
cursor fks is
select a.application_id, a.application_short_name, ft.table_name,
ft.table_id, f.foreign_key_id,
f.foreign_key_name, f.condition
from fnd_tables ft, fnd_foreign_keys f, fnd_application a
where f.primary_key_application_id = x_application_id
and f.primary_key_table_id = x_primary_table_id
and f.primary_key_id = x_primary_key_id
and ft.table_id = f.table_id
and ft.application_id = f.application_id
and ft.application_id = a.application_id;
select fc.column_name
from fnd_columns fc, fnd_foreign_key_columns fcc
where fcc.foreign_key_id = fkid
and fcc.table_id = fktabid
and fcc.application_id = fkapplid
and fcc.column_id = fc.column_id
and fcc.table_id = fc.table_id
and fcc.application_id = fc.application_id
order by fcc.foreign_key_sequence;
l_api_name CONSTANT varchar2(30) := 'UpdateChildren';
selbuf := 'select ''Y'' from dual where exists (select 1 from '||
fk.table_name||' where ';
updbuf := 'update '||fk.table_name||' set ';
fnd_message.set_token('UPDATE_STATEMENT', updbuf);
c_log_head || l_api_name || '.update_failed', FALSE);
c_log_head || l_api_name || '.update_failed', FALSE);
tmpbuf||' or LAST_UPDATED_BY or LAST_UPDATE_DATE' );
c_log_head || l_api_name || '.update_failed', FALSE);
fnd_message.set_name('FND', 'FK_DUPLICATE_COLUMN_UPDATE');
c_log_head || l_api_name || '.update_failed', FALSE);
fnd_message.set_token('ROUTINE', 'UpdateChildren');
c_log_head || l_api_name || '.update_failed', FALSE);
fnd_message.set_name('FND', 'FK_FOUND_NO_DELETE_PK');
ret := UpdatePKColumns(fk.application_short_name,
fk.table_name,
colnames,
x_primary_key_col_value_old,
x_primary_key_col_value_new);
end UpdateOrCheckChildren;
function UpdatePKCols(x_application_short_name in varchar2,
x_primary_table_name in varchar2,
x_primary_key_col_names in NameArrayTyp,
x_primary_key_col_value_old in NameArrayTyp,
x_primary_key_col_value_new in NameArrayTyp)
return boolean is
appl_id number;
l_api_name CONSTANT varchar2(30) := 'UpdatePKColumns';
select c.column_name
from fnd_columns c, fnd_primary_key_columns pc
where pc.application_id = aid
and pc.table_id = tid
and pc.primary_key_id = pid
and pc.column_id = c.column_id
and c.application_id = aid
and c.table_id = tid
order by pc.primary_key_sequence;
select p.primary_key_id, p.primary_key_name
from fnd_primary_keys p
where p.application_id = aid
and p.table_id = tid;
select a.application_id, t.table_id
into appl_id, tab_id
from fnd_application a, fnd_tables t
where a.application_short_name = x_application_short_name
and a.application_id = t.application_id
and t.table_name = x_primary_table_name;
fnd_message.set_token('ROUTINE', 'UpdatePKColumns');
hasChild := UpdateOrCheckChildren(appl_id, tab_id, pk.primary_key_id,
colseqs, x_primary_key_col_value_old, x_primary_key_col_value_new);
ret := UpdateOrCheckChildren(appl_id, tab_id, pk.primary_key_id, colseqs,
x_primary_key_col_value_old,
x_primary_key_col_value_new);
end UpdatePKCols;
function UpdatePKColumns(x_application_short_name in varchar2,
x_primary_table_name in varchar2,
x_primary_key_col_names in NameArrayTyp,
x_primary_key_col_value_old in NameArrayTyp,
x_primary_key_col_value_new in NameArrayTyp)
return boolean is
ret boolean;
ret := UpdatePKCols(x_application_short_name,
x_primary_table_name,
x_primary_key_col_names,
x_primary_key_col_value_old,
x_primary_key_col_value_new);
end UpdatePKColumns;
ret := UpdatePKCols(x_application_short_name, x_primary_table_name,
x_primary_key_col_names, x_primary_key_col_value_old,
nullarray);