-- 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 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.