Tuesday 27 June 2017

Definer and Invoker Rights in Oracle



create or replace procedure sp_table_stats AUTHID CURRENT_USER
as

TYPE ty_table_list is TABLE of VARCHAR(5000) index by binary_integer;
v_tab_list ty_table_list;
v_count number;
v_stmt varchar(500);
begin
select table_name bulk collect into v_tab_list from user_tables where table_name not like 'AYX%';
for i in v_tab_list.first .. v_tab_list.count loop
v_stmt := 'select count(*) from '||v_tab_list(i);
dbms_output.put_line('Statement is - '||v_stmt);
execute immediate v_stmt into v_count;
dbms_output.put_line(v_stmt ||'; count is -'||v_count);
end loop;
end;
/

No comments:

Post a Comment