使用dbms_sql的权限不足 [英] insufficient privileges using dbms_sql
问题描述
我有一个使用dbms_sql软件包的PLSQL代码.例如,它从序列创建开始.
I have a PLSQL code using dbms_sql package. For example it starts with sequence creation.
request:= 'CREATE SEQUENCE ' || utilisateur || '.' || 'seq_fusion_table
MINVALUE 1
START WITH 1
INCREMENT BY 1';
dbms_sql.parse(curseur_ref, request, dbms_sql.native);
response := dbms_sql.execute(curseur_ref);
我有一个错误:
ORA-01031: insufficient privileges
我认为用户无法使用dbms_sql,因此我发送了此请求:
I thought the user could not use dbms_sql so I sent this request :
GRANT execute on DBMS_SQL to user;
commit;
为了确保我发送的创建请求没有使用dbms_sql,确实用户有权创建序列.
And just to be sure I sent the creation request without using dbms_sql and indeed the user has the right to create sequences.
我应该怎么做才能摆脱这种权限不足的错误?
What should I do to get rid of this insufficient privileges error ?
谢谢.
推荐答案
通过角色授予的特权在PL/SQL内部无效.您需要向用户授予直接创建序列 的特权:
Privileges granted through a role are not active inside PL/SQL. You need to grant the privilege to create sequences directly to the user:
grant create sequence to the_user;
然后它也应该可以在PL/SQL中运行.
Then it should also work from within PL/SQL.
这篇关于使用dbms_sql的权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!