我必须为不同的用户提供多种权限。目前我在oracle中手动(逐个)运行脚本,如 -
GRANT SELECT ON xyz.a_BCKUP TO abc;
GRANT SELECT ON xyz.b_BCKUP TO abc;
GRANT SELECT ON xyz.c_BCKUP TO abc;
GRANT SELECT,INSERT,DELETE,UPDATE ON abc.map1 TO xyz;
GRANT SELECT,INSERT,DELETE,UPDATE ON abc.map2 TO xyz;
GRANT SELECT,INSERT,DELETE,UPDATE ON abc.map3 TO xyz;
我的目标是一次性运行它。我可以放入SP并执行。它会在ORACLE中运行吗?我对此不太确定。没有SP的任何想法!!
CREATE or replace
PROCEDURE GRANTS AS
BEGIN
*grant permission script*
END;
答案 0 :(得分:0)
您可以将动态SQL用于此
CREATE OR REPLACE PROCEDURE GRANT_PROC AS
v_sql VARCHAR2(10000);
BEGIN
v_sql := 'GRANT SELECT ON xyz.a_BCKUP TO abc';
EXECUTE IMMEDIATE v_sql;
END;