问题1:
以下SQL语句在创建存储过程时报错:Pl/sql:ORA-00942:table or view does not exist,但是单独在SQL 窗口是可以执行的,登录用户是具有dba权限的。
SELECT MAX(Column_id) INTO v_ColumnId
   FROM sys.dba_tab_columns
   WHERE lower(table_name) = 'tab_aaa';问题2:
   v_sql := 'CREATE OR REPLACE VIEW ' || v_viewName ||' AS
   SELECT col1, col2, '|| v_ColName ||  ' AS ISPROC
   FROM tab_aaa  ORDER BY col1';
   execute IMMEDIATE v_sql;  以上是存储过程中动态创建视图语句,登录用户和存储过程拥有者都是DBA权限用户,但执行存储过程时,报
insufficient privileges.请问如何解决?

解决方案 »

  1.   

    存储过程里面role权限失效,需要直接付权限
    可以使用 grant select any dictionary to username
    在sqlplus里面因为有dba权限可以查询这些记录
    如果执行set role none后就不能查询这些表了问题2: 也类似 需要直接grant create view权限
      

  2.   

    Oracle provides for easy and controlled privilege management through roles. Roles are named groups of related privileges that you grant to users or other roles. Roles are designed to ease the administration of end-user system and schema object privileges. However, roles are not meant to be used for application developers, because the privileges to access schema objects within stored programmatic constructs need to be granted directly.角色对开发来说没有意义,因为在存储程序中访问对像的权限需要直接授予