| Oracle动态sql在存储过程中出现表或视图不存在的解决方法    CREATE OR REPLACE PROCEDURE P_test is strsql varchar2(2000); BEGIN       --导入用户数据数据                 strsql := 'insert into tabuser (usercode) select us.tabuser.usercode from us.tabuser'     execute immediate strsql;         EXCEPTIONwhen others   then
 raise FIND_DATA_EMP;
 end P_test;
   会出现 ORA-00942: 表或视图不存在 这种情况为  用户拥有的role权限在存储过程是不可用的。遇到这种情况,我们一般需要显式进行系统权限,如grant create table to suk;但这种方法太麻烦,有时候可能需要进行非常多的授权才能执行存储过程,实际上,oracle给我们提供了在存储过程中使用role权限的方法:修改存储过程,加入Authid Current_User时存储过程可以使用role权限     CREATE OR REPLACE PROCEDURE P_test Authid Current_User is strsql varchar2(2000); BEGIN       --导入用户数据数据                 strsql := 'insert into tabuser (usercode) select us.tabuser.usercode from us.tabuser'     execute immediate strsql;         EXCEPTIONwhen others   then
 raise FIND_DATA_EMP;
 end P_test;
   http://blog.csdn.net/sscsgss/article/details/4738470 |