All pastes #283956 Raw Edit

Someone

public text v1 · immutable
#283956 ·published 2006-12-18 19:33 UTC
rendered paste body
-- when I define like so and execute it once, all is well


declare
        CURSOR c1 is select table_name from sys.all_tables where owner = 'USER1';
begin
   for x in c1 loop
      execute immediate 'grant select on USER1.' || x.table_name |
| ' to SOME_ROLE' ;
   END loop;
END;


-- however, when I do it like this and try to store the procedure, nothing happens:

create or replace procedure do_grant as
CURSOR c1 is select table_name from SYS.all_tables where owner = 'USER1';
begin
   for x in c1 LOOP
      execute immediate 'grant select on USER1.' || x.table_name || ' to SOME_ROLE' ;
   END LOOP;
END;


-- I no compilation errors, but when I "execute do_grant" nothing actually happens.