不足的私密性错误

时间:2016-12-10 11:35:46

标签: sql oracle

我一直在某个架构上执行各种pl / sql程序,它们都运行良好。但是在执行一个特定的过程时,我得到了错误

SQL> execute call_para_cursor
BEGIN call_para_cursor; END;

*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYSTEM.CALL_PARA_CURSOR", line 4
ORA-06512: at line 1

虽然我正在同一架构上执行该程序,但它要求我获得更多权限。 我如何解决这种情况?

create or replace procedure call_para_cursor as

BEGIN
 execute immediate ' create or replace procedure para_cursor_test as
cursor c_p_det(tar_val number) is select name, salary from fees where salary    < tar_val;
nname varchar2(30);
ssalary number(5);
BEGIN
Open c_p_det(1000);
LOOP
FETCH c_p_det into nname, ssalary;
DBMS_OUTPUT.PUT_LINE(NNAME || SSALARY);
EXIT WHEN C_P_DET%NOTFOUND;
END LOOP;
CLOSE C_P_DET;
END';

dbms_output.put_line('done processing !!');
END;

2 个答案:

答案 0 :(得分:1)

问题是一些事情的组合:

  1. 默认情况下,该过程作为定义者权限运行。执行过程时,将仅使用直接授予过程所有者的权限。通过角色授予的权限将被忽略。
  2. 该程序归SYSTEM所有,默认情况下没有直接授予public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('roles_id')->nullable(); $table->string('username')->unique(); $table->string('email')->unique(); $table->string('name')->unique(); $table->string('password'); $table->string('cover'); $table->rememberToken(); $table->timestamps(); }); Schema::create('roles', function (Blueprint $table){ $table->increments('id'); $table->string('rolename'); }); schema::table('users', function (Blueprint $table){ $table->foreign('roles_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); }); }
  3. 但在运行()之前 - 您几乎肯定不想将SYSTEM用于任何自定义代码。

答案 1 :(得分:0)

在处理函数和过程时,您可以授予用户执行这些函数和过程的能力。

GRANT EXECUTE ON object TO user;

object :您授予权限的数据库对象的名称。

用户:将被授予EXECUTE权限的用户的名称。