The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE DeleteBrObjectRec(
p_obj_id in number
);
PROCEDURE DeleteHelperRecs(
p_obj_def_id in number
);
PROCEDURE DeleteMappingRuleRec(
p_obj_def_id in number
);
PROCEDURE DeleteFormulaRecs(
p_obj_def_id in number
);
PROCEDURE DeleteDimensionRecs(
p_obj_def_id in number
);
PROCEDURE delete_dimension_rec (
p_obj_def_id in number
,p_func_seq in number);
PROCEDURE DeleteObjectDetails (
p_obj_id in number
)
IS
g_api_name constant varchar2(30) := 'DeleteObjectDetails';
DeleteBrObjectRec (
p_obj_id => p_obj_id
);
END DeleteObjectDetails;
PROCEDURE DeleteObjectDefinition(
p_obj_def_id in number
)
--------------------------------------------------------------------------------
IS
l_api_name constant varchar2(30) := 'DeleteObjectDefinition';
DeleteHelperRecs(
p_obj_def_id => p_obj_def_id
);
,p_msg_text => 'After DeleteHelperRecs'
);
DeleteDimensionRecs(
p_obj_def_id => p_obj_def_id
);
,p_msg_text => 'After DeleteDimensionRecs' );
DeleteFormulaRecs(
p_obj_def_id => p_obj_def_id
);
,p_msg_text => 'After DeleteFormulaRecs' );
DeleteMappingRuleRec(
p_obj_def_id => p_obj_def_id
);
,p_msg_text => 'After DeleteMappingRuleRec' );
END DeleteObjectDefinition;
select object_definition_id
from fem_object_definition_b
where object_id = p_obj_id
and old_approved_copy_flag = 'N';
select sub_object_id
into l_cond_id
from fem_alloc_br_formula
where object_definition_id = p_obj_def_id
and function_seq = p_func_seq;
PROCEDURE DeleteHelperRecs(
p_obj_def_id in number
)
--------------------------------------------------------------------------------
IS
v_return_status VARCHAR2(1);
SELECT helper_obj_def_id, helper_object_id, helper_object_type_code
FROM fem_objdef_helper_rules
WHERE object_definition_id = p_rule_def_id
AND helper_obj_def_id NOT IN (select helper_obj_def_id
FROM fem_objdef_helper_rules
WHERE object_definition_id <> p_rule_def_id);
FEM_BUSINESS_RULE_PVT.DeleteObjectDefinition (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
x_return_status => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
p_object_type_code => helper_rule.helper_object_type_code,
p_obj_def_id => helper_rule.helper_obj_def_id);
/* Have we deleted the last object definition for this helper object?
If so - delete the helper object also*/
SELECT count(*)
INTO v_count
FROM fem_object_definition_b
WHERE object_id = helper_rule.helper_object_id;
FEM_BUSINESS_RULE_PVT.DeleteObject (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
x_return_status => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
p_object_type_code => helper_rule.helper_object_type_code,
p_obj_id => helper_rule.helper_object_id);
/* Last step - delete all of the helper rule registrations for the object def
being deleted*/
DELETE FROM fem_objdef_helper_rules
WHERE object_definition_id = p_obj_def_id;
END DeleteHelperRecs;
PROCEDURE DeleteBrObjectRec(
p_obj_id in number
)
--------------------------------------------------------------------------------
IS
BEGIN
delete from fem_alloc_br_objects
where map_rule_object_id = p_obj_id;
END DeleteBrObjectRec;
PROCEDURE DeleteMappingRuleRec(
p_obj_def_id in number
)
--------------------------------------------------------------------------------
IS
BEGIN
delete from fem_alloc_business_rule
where object_definition_id = p_obj_def_id;
END DeleteMappingRuleRec;
PROCEDURE DeleteFormulaRecs(
p_obj_def_id in number
)
--------------------------------------------------------------------------------
IS
CURSOR c_local_cond_id (p_rule_def_id NUMBER)
IS
select sub_object_id
from fem_alloc_br_formula formula
where formula.object_definition_id = p_rule_def_id
and exists (select 1
from fem_object_catalog_b obj
where obj.object_id = formula.sub_object_id
and obj.object_type_code = 'CONDITION_MAPPING');
l_api_name constant varchar2(30) := 'DeleteFormulaRecs';
,p_msg_text => 'Before calling FEM_BUSINESS_RULE_PVT.DeleteObject, l_local_cond_id: '
|| l_local_cond_id
);
FEM_BUSINESS_RULE_PVT.DeleteObject (
p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_FALSE
,x_return_status => l_return_status
,x_msg_count => l_msg_count
,x_msg_data => l_msg_data
,p_object_type_code => 'CONDITION_MAPPING'
,p_obj_id => l_local_cond_id
);
,p_msg_text => 'After calling FEM_BUSINESS_RULE_PVT.DeleteObject, l_local_cond_id: '
|| l_local_cond_id
);
,p_msg_text => 'After calling FEM_BUSINESS_RULE_PVT.DeleteObject, l_return_status = FND_API.G_RET_STS_ERROR '
);
,p_msg_text => 'After calling FEM_BUSINESS_RULE_PVT.DeleteObject, l_return_status = FND_API.G_RET_STS_UNEXP_ERROR '
);
delete from fem_alloc_br_formula
where object_definition_id = p_obj_def_id;
END DeleteFormulaRecs;
PROCEDURE DeleteDimensionRecs(
p_obj_def_id in number
)
--------------------------------------------------------------------------------
IS
BEGIN
delete from fem_alloc_br_dimensions
where object_definition_id = p_obj_def_id;
END DeleteDimensionRecs;
insert into fem_alloc_br_objects (
MAP_RULE_OBJECT_ID
,MAP_RULE_TYPE_CODE
,OBJECT_VERSION_NUMBER
,CREATION_DATE
,CREATED_BY
,LAST_UPDATED_BY
,LAST_UPDATE_DATE
,LAST_UPDATE_LOGIN
) select
p_target_obj_id
,MAP_RULE_TYPE_CODE
,OBJECT_VERSION_NUMBER
,nvl(p_creation_date,creation_date)
,nvl(p_created_by,created_by)
,FND_GLOBAL.user_id
,sysdate
,FND_GLOBAL.login_id
from fem_alloc_br_objects
where map_rule_object_id = p_source_obj_id;
insert into fem_alloc_business_rule (
object_definition_id
,cost_contribution_flag
,accumulate_flag
/*,source_where_clause
,driver_where_clause*/
,formula
,created_by
,creation_date
,last_updated_by
,last_update_date
,last_update_login
,object_version_number
) select
p_target_obj_def_id
,cost_contribution_flag
,accumulate_flag
/*,source_where_clause
,driver_where_clause*/
,formula
,nvl(p_created_by,created_by)
,nvl(p_creation_date,creation_date)
,FND_GLOBAL.user_id
,sysdate
,FND_GLOBAL.login_id
,object_version_number
from fem_alloc_business_rule
where object_definition_id = p_source_obj_def_id;
select
p_target_obj_def_id object_definition_id
,function_seq
,function_cd
,sub_object_id
,value
,table_name
,column_name
,math_operator_cd
,formula_macro_cd
,force_to_100_flg
,enable_flg
,post_to_ledger_flg
,open_paren
,close_paren
,apply_to_debit_code
,nvl(p_created_by,created_by) created_by
,nvl(p_creation_date,creation_date) creation_date
,FND_GLOBAL.user_id last_updated_by
,sysdate last_update_date
,FND_GLOBAL.login_id LAST_UPDATE_LOGIN
,object_version_number
from fem_alloc_br_formula formula
where formula.object_definition_id = p_obj_def_id
and exists (select 1
from fem_object_catalog_b obj
where obj.object_id = formula.sub_object_id
and obj.object_type_code = 'CONDITION_MAPPING');
insert into fem_alloc_br_formula (
object_definition_id
,function_seq
,function_cd
,sub_object_id
,value
,table_name
,column_name
,math_operator_cd
,formula_macro_cd
,force_to_100_flg
,enable_flg
,post_to_ledger_flg
,open_paren
,close_paren
,apply_to_debit_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,last_update_login
,object_version_number
) select
p_target_obj_def_id
,function_seq
,function_cd
,sub_object_id
,value
,table_name
,column_name
,math_operator_cd
,formula_macro_cd
,force_to_100_flg
,enable_flg
,post_to_ledger_flg
,open_paren
,close_paren
,apply_to_debit_code
,nvl(p_created_by,f.created_by)
,nvl(p_creation_date,f.creation_date)
,FND_GLOBAL.user_id
,sysdate
,FND_GLOBAL.login_id
,f.object_version_number
from fem_alloc_br_formula f
where f.object_definition_id = p_source_obj_def_id
and (f.sub_object_id is NULL
or NOT EXISTS (select 1
from fem_object_catalog_b o
where o.object_id = f.sub_object_id
and o.object_type_code = 'CONDITION_MAPPING'));
insert into fem_alloc_br_formula (
object_definition_id
,function_seq
,function_cd
,sub_object_id
,value
,table_name
,column_name
,math_operator_cd
,formula_macro_cd
,force_to_100_flg
,enable_flg
,post_to_ledger_flg
,open_paren
,close_paren
,apply_to_debit_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,last_update_login
,object_version_number
) values (
l_formula_rec.object_definition_id
,l_formula_rec.function_seq
,l_formula_rec.function_cd
,l_target_cond_obj_id
,l_formula_rec.value
,l_formula_rec.table_name
,l_formula_rec.column_name
,l_formula_rec.math_operator_cd
,l_formula_rec.formula_macro_cd
,l_formula_rec.force_to_100_flg
,l_formula_rec.enable_flg
,l_formula_rec.post_to_ledger_flg
,l_formula_rec.open_paren
,l_formula_rec.close_paren
,l_formula_rec.apply_to_debit_code
,l_formula_rec.created_by
,l_formula_rec.creation_date
,l_formula_rec.last_updated_by
,l_formula_rec.last_update_date
,l_formula_rec.last_update_login
,l_formula_rec.object_version_number
);
update fem_object_dependencies
set required_object_id = l_target_cond_obj_id
where object_definition_id = l_formula_rec.object_definition_id
and required_object_id = l_source_cond_obj_id;
insert into fem_alloc_br_dimensions (
object_definition_id
,function_seq
,alloc_dim_col_name
,post_to_balances_flag
,function_cd
,alloc_dim_usage_code
/* ,hierarchy_obj_def_id
,alloc_dim_track_flag*/
,dimension_value
,dimension_value_char
,percent_distribution_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,last_update_login
,object_version_number
) select
p_target_obj_def_id
,function_seq
,alloc_dim_col_name
,post_to_balances_flag
,function_cd
,alloc_dim_usage_code
/* ,hierarchy_obj_def_id
,alloc_dim_track_flag*/
,dimension_value
,dimension_value_char
,percent_distribution_code
,nvl(p_created_by,created_by)
,nvl(p_creation_date,creation_date)
,FND_GLOBAL.user_id
,sysdate
,FND_GLOBAL.login_id
,object_version_number
from fem_alloc_br_dimensions
where object_definition_id = p_source_obj_def_id;
select function_seq, function_cd, table_name, nvl (post_to_ledger_flg, 'N') as post_to_ledger_flg
from FEM_ALLOC_BR_FORMULA
where object_definition_id = p_obj_def_id
and function_cd in ('FILTER', 'DEBIT', 'CREDIT',
'TABLE_ACCESS', 'PCT_DISTRB', 'LEAFFUNC')
order by function_seq asc;
update FEM_ALLOC_BR_FORMULA set table_name = L_DEFAULT_TABLE,
column_name = l_col_name, sub_object_id = null
where object_definition_id = p_obj_def_id
and function_seq = l_formula_rec.function_seq;
delete_dimension_rec (
p_obj_def_id => p_obj_def_id
,p_func_seq => l_formula_rec.function_seq);
select 1
FROM fem_table_class_assignmt tc, fem_table_class_usages tu
where tu.table_classification_code = tc.table_classification_code
and tc.enabled_flag = 'Y'
and tc.table_name = p_table_name;
PROCEDURE delete_dimension_rec (
p_obj_def_id in number
,p_func_seq in number)
IS
BEGIN
delete from fem_alloc_br_dimensions
where object_definition_id = p_obj_def_id
and function_seq = p_func_seq;
select column_name
from fem_tab_column_prop
where column_property_code = p_column_property_code
and table_name = p_table_name;
insert into fem_alloc_br_dimensions (
object_definition_id
,function_seq
,alloc_dim_col_name
,post_to_balances_flag
,function_cd
,alloc_dim_usage_code
,dimension_value
,dimension_value_char
,percent_distribution_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,last_update_login
,object_version_number)
values
(p_obj_def_id
,p_func_seq
,l_dimension_candidate.column_name
,p_post_to_balance_flag
,p_function_cd
,p_alloc_dim_usage_code
,null
,null
,p_percent_distribution_code
,FND_GLOBAL.User_ID
,l_date
,FND_GLOBAL.User_ID
,l_date
,FND_GLOBAL.Conc_Login_ID
,1.0);
select alloc_dim_col_name, alloc_dim_usage_code
from fem_alloc_br_dimensions
where object_definition_id = p_obj_def_id
and function_seq = p_func_seq
and alloc_dim_col_name not in
(select column_name
from fem_tab_column_prop
where column_property_code = p_column_property_code
and table_name = p_table_name);
select column_name
from fem_tab_column_prop
where column_property_code = p_column_property_code
and table_name = p_table_name
and column_name not in (select alloc_dim_col_name
from fem_alloc_br_dimensions
where object_definition_id = p_obj_def_id
and function_seq = p_func_seq);
delete from fem_alloc_br_dimensions
where object_definition_id = p_obj_def_id
and function_seq = p_func_seq
and alloc_dim_col_name = l_orphan_dimensions_rec.alloc_dim_col_name;
update fem_alloc_br_dimensions
set percent_distribution_code = 'NOT_APPLICABLE'
where object_definition_id = p_obj_def_id
and alloc_dim_col_name = l_orphan_dimensions_rec.alloc_dim_col_name
and function_cd = 'PCT_DISTRB'
and percent_distribution_code in ('PERCENT_DISTRIBUTION', 'MATCHING_DIMENSION');
insert into fem_alloc_br_dimensions (
object_definition_id
,function_seq
,alloc_dim_col_name
,post_to_balances_flag
,function_cd
,alloc_dim_usage_code
,dimension_value
,dimension_value_char
,percent_distribution_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,last_update_login
,object_version_number)
values
(p_obj_def_id
,p_func_seq
,l_missing_dimensions_rec.column_name
,p_post_to_balance_flag
,p_function_cd
,p_alloc_dim_usage_code
,null
,null
,p_percent_distribution_code
,FND_GLOBAL.User_ID
,l_date
,FND_GLOBAL.User_ID
,l_date
,FND_GLOBAL.Conc_Login_ID
,1.0);
delete_map_rule_content
This procedure deletes the data from the 3 tables that store
the mapping rule content viz. FEM_ALLOC_BUSINESS_RULE,
FEM_ALLOC_BR_FORMULA and FEM_ALLOC_BR_DIMENSIONS.
*************************************************************************/
PROCEDURE delete_map_rule_content(p_object_definition_id IN NUMBER)
IS
c_api_name constant varchar2(30) := ' delete_map_rule_content';
DeleteDimensionRecs(
p_obj_def_id => p_object_definition_id
);
DeleteFormulaRecs(
p_obj_def_id => p_object_definition_id
);
DeleteMappingRuleRec(
p_obj_def_id => p_object_definition_id
);
END delete_map_rule_content;
PROCEDURE DeleteTuningOptionDetails(
p_obj_id in number
)
--------------------------------------------------------------------------------
IS
l_return_status varchar2(1);
FEM_ADMIN_UTIL_PKG.Delete_Obj_Tuning_Options (
p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_FALSE
,p_encoded => FND_API.G_FALSE
,x_return_status => l_return_status
,x_msg_count => l_msg_count
,x_msg_data => l_msg_data
,p_object_id => p_obj_id
);
END DeleteTuningOptionDetails;