工作总结:在oracle下给某个用户授予访问本用户下所有表的权限.
例如:把scott用户下的所有表的查询权限授予T用户.
create or replace procedure grant_selectAll_sql as
The_c1 Integer;
The_result number;
v_Table varchar2(80);
v_sql varchar2(400);
Begin
The_C1 :=Dbms_sql.open_cursor;
Dbms_sql.parse(the_C1,'Select table_name From User_Tables',dbms_sql.native);
Dbms_sql.define_column(the_c1,1,v_Table,80);
The_result:=Dbms_sql.execute(The_c1);
loop
If dbms_sql.fetch_rows(The_c1) > 0 then
Dbms_sql.column_value(The_c1,1,v_Table);
v_sql := 'Grant Select On '||v_Table||' to T';
Execute Immediate v_sql;
else
exit;
End if;
end loop;
Dbms_sql.close_cursor(The_C1);
End;