create or replace view b1_temp_v as select a.resp_id as responsibility_id ,b.responsibility_key as responsibility_key ,b.request_group_id as request_group_id ,b.responsibility_name as responsibility_name ,a.mf_type as mf_type ,a.main_menu_id as main_menu_id ,to_number(a.seq) as seq ,a.menu_fn_id as menu_fn_id ,a.name as name ,a.description as description ,a.content_group as content_group ,a.content_type as content_type ,decode(a.content_group,'Concurrent' ,decode(a.content_type, 'A','Spawned', 'B','Request Set Stage Function', 'E','Perl Concurrent Program' , 'F','Flex SQL', 'H','Host', 'I','PL/SQL Stored Procedure', 'J','Java Stored Procedure' , 'K','Java Concurrent Program', 'L','SQL*Loader', 'M','Multi-Language Function' , 'P','Oracle Reports', 'Q','SQL*Plus', 'R','SQL*Report', 'S','Immediate' , 'X','Flex Reports', 'Z','Shutdown Callback' , a.content_type) ,'Function','Function' ,'Menu','Menu' ,a.content_type) as content_type_name ,case when a.content_group = 'Menu' then (select user_menu_name from fnd_menus_vl where menu_id = a.menu_fn_id) when a.content_group = 'Function' then (select user_function_name from fnd_form_functions_vl where function_id = a.menu_fn_id) when a.mf_type = 'Concurrent' then (select user_concurrent_program_name from fnd_concurrent_programs_vl where concurrent_program_id = a.menu_fn_id) end as user_mf_name from b1_temp a ,fnd_responsibility_vl b where a.resp_id = b.responsibility_id order by a.resp_id, a.mf_type desc, to_number(a.seq) asc