The following lines contain the word 'select', 'insert', 'update' or 'delete':
select count(object_name)
into l_table_exists
from all_objects
where object_name = p_base_table_name
and object_type in ('TABLE','VIEW');
select nvl(custom, 'N')
into l_custom_flag
from asg_pub
where pub_id = ( select pub_name from asg_pub_item
where item_id = p_pub_item_name);
select base_object_name ,primary_key_column, access_name, parent_table
into l_piv_name, l_pk_columns, l_acc_table_name,l_parent_table
from asg_pub_item
where item_id = p_pub_item_name;
l_cmd := 'select count(*) from '||l_acc_table_name;
l_new_query := ' select acc.access_id ';
select count(*) into l_cols_count
from all_tab_columns
where table_name = l_piv_name
and owner=APPS_SCHEMA_NAME;
SELECT count(*) into l_cols_count
FROM all_synonyms syn, dba_tab_columns col
WHERE syn.table_owner = APPS_SCHEMA_NAME
AND syn.synonym_name = l_piv_name
AND col.owner = syn.table_owner AND col.table_name = syn.table_name;
select data_type into c_type
from all_tab_columns
where table_name = l_piv_name
and column_name = 'ATTRIBUTE'||to_char(l_cols_count-1)
and rownum = 1 and owner=APPS_SCHEMA_NAME;
SELECT data_type into c_type
FROM all_synonyms syn, dba_tab_columns col
WHERE syn.table_owner = APPS_SCHEMA_NAME
AND syn.synonym_name = l_piv_name AND col.owner = syn.table_owner
AND col.table_name = syn.table_name
AND col.column_name = 'ATTRIBUTE'||to_char(l_cols_count-1)
AND rownum = 1;
log('update the asg_pub_item table.');
update asg_pub_item
set parent_table = p_base_table_name,
last_update_date = sysdate
where item_id = P_pub_item_name;
select data_type into l_type
from all_tab_columns
where table_name = B_TAB_NAME
and column_name = col
and rownum = 1 and owner=APPS_SCHEMA_NAME;
SELECT data_type into l_type
FROM all_synonyms syn, dba_tab_columns dba_cols
WHERE syn.table_owner = APPS_SCHEMA_NAME
AND syn.synonym_name = B_TAB_NAME AND dba_cols.owner = syn.table_owner
AND dba_cols.table_name = syn.table_name AND dba_cols.column_name = col
AND rownum = 1 ;