使用Toad创建存储过程出现错误并解决

存储过程中遇到ora-00942表或视图不存在

CREATE OR REPLACE PROCEDURE p

IS

   CURSOR c

   IS

      SELECT *

        FROM scott.emp

      FOR UPDATE;

 

BEGIN

   FOR v_temp IN c

   LOOP

      IF (v_temp.deptno = 10)

      THEN

         UPDATE scott.emp

            SET sal = sal + 10

          WHERE CURRENT OF c;

      ELSIF (v_temp.deptno = 20)

      THEN

         UPDATE scott.emp

            SET sal = sal + 20

          WHERE CURRENT OF c;

      ELSE

         UPDATE scott.emp

            SET sal = sal + 50

          WHERE CURRENT OF c;

      END IF;

   END LOOP;

 

   COMMIT;

END;

 

 使用toad创建存储过程出现错误:

Warning: compiled but with compilation errors.

打印错误确是:ORA-00942: table or view does not exist

查了下资料才知道

sys.fga_log$ 是记录fga审计记录的基本表。

解决方法:
以sys身份登录,为system赋予select 和delete sys.fga_log$的权限,否则下边的存储过程添加会有问题。
Sql> grant select ,delete on sys.fga_log$ to system;

posted @ 2014-12-19 17:21  行动派大鹏  阅读(659)  评论(0编辑  收藏  举报