手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

PL/SQL: ORA-00942: table or view does not exist

[日期:2013-01-19] 来源:Linux社区  作者:eric0435 [字体: ]

有两个用户jytest,jytest1都拥有dba权限在jytest1用户创建了一个表test

create user jytest identified by "jytest"

default tablespace users temporary tablespace temp;

 


grant dba to jytest;

grant resource  to jytest;

grant connect to jytest;

 


create user jytest1 identified by "jytest1"

default tablespace users temporary tablespace temp;

 


grant dba to jytest1;

grant resource  to jytest1;

grant connect to jytest1;

 


create table jytest1.test(userid number(20));

 


SQL> select a.owner,a.object_name,a.object_type from dba_objects a where a.object_id=52603;

 


OWNER                          OBJECT_NAME                        OBJECT_TYPE

------------------------------ ----------------------------------- -------------------

JYTEST1                        TEST                                TABLE

在用户jytest下可以直接查询jytest1.test表但是在jytest下创建一个过程,在过程中引用jytest1.test表编译不通过.在过程中引用别的用户对象不能通过role权限来访问,要通过对象授权才能在过程中访问

SQL> alter session set events '10046 trace name context forever,level 12';

Session altered

SQL> select * from jytest1.test;

 


              USERID---------------------

 


SQL> alter session set events '10046 trace name context off';

 


Session altered

 


它的跟踪文件中显示的记录部分信息如下:select col#, grantee#, privilege#,max(mod(nvl(option$,0),2)) from objauth$ where obj#=:1 and col# is not null group by privilege#, col#, grantee# order by col#, grantee#END OF STMTPARSE #2:c=0,e=86,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1355777810000085BINDS #2:kkscoacd Bind#0

  acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00

  acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0

  kxsbbbfp=b7f47498  bln=22  avl=04  flg=05

  value=52603上面的操作显示了用户jytest在执行select * from jytest1.test查询时会查询jytest用户对jytest1.test表是否有select权限

 


  select con#,obj#,rcon#,enabled,nvl(defer,0) from cdef$ where robj#=:1END OF STMTPARSE #4:c=0,e=55,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1355777810001339BINDS #4:kkscoacd Bind#0

  acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00

  acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0

  kxsbbbfp=b7ecffb8  bln=22  avl=04  flg=05

  value=52603

 


上面的查询是查询jytest1.test表中的列的定义

linux
相关资讯       PL/SQL  ORA-00942 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款