在我們使用Oracle數據庫時,如果要把oracle查詢權限賦給另一個用戶,該怎麼做呢?下面用一個批量處理語句實現了將Oracle查詢權限賦與另一用戶,如果您感興趣的話,不妨一看。
- create or replace procedure grant_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 brokeruser3';
- Execute Immediate v_sql;
- else
- exit;
- End if;
- end loop;
- Dbms_sql.close_cursor(The_C1);
- End;