大家我好的数据库里有三张这样的表,其物理结构和逻辑结构如下图现在我想在sql/plus中创建一个视图
plsql的代码如下:
create or replace view view_user_priv
as select [mytemp].username, nccsiprivilege.privname from
(select nccsiuser.username,r_user_priv.pid from nccsiuser right join
r_user_priv on nccsiuser.uid = r_user_priv.uid as [mytemp])
right join nccsiprivilege on [mytemp].pid = nccsiprivilege.pid;得到的错误如下:请高手替我解答.........
本人处于极度郁闷中..............

解决方案 »

  1.   

    create or replace view view_user_priv
    as select mytemp.username, nccsiprivilege.privname from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid) as mytemp
    right join nccsiprivilege on mytemp.pid = nccsiprivilege.pid
      

  2.   

    試一下把[mytemp]的中括號去掉吧
      

  3.   

    我试过了
    代码如下
    create or replace view view_user_priv
    as select mytemp.username, nccsiprivilege.privname from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid as mytemp)
    right join nccsiprivilege on [mytemp].pid = nccsiprivilege.pid;
    得到的错误如下我确保数据库中的表nccsiuser,r_user_priv都存在
      

  4.   

    楼上有好几位说看不到图
    好,我再重新把问题发一遍,恳请大家赐教
    我好的数据库里有三张这样的表,其物理结构和逻辑结构如下图开始我创建view的sql代码为:
    create or replace view view_user_priv
    as select [mytemp].username, nccsiprivilege.privname from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid as [mytemp])
    right join nccsiprivilege on [mytemp].pid = nccsiprivilege.pid;
    得到的错误提示为: 文字提示为:
     as select [mytemp].username, nccsiprivilege.privname from
     ERROR at line 2:  ORA-00936: missing expression;

    后来按照2楼和3楼的意思,将代码改为
    create or replace view view_user_priv
    as select mytemp.username, nccsiprivilege.privname from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid) as mytemp
    right join nccsiprivilege on mytemp.pid = nccsiprivilege.pid;
    得到的错误提示为 文字提示为:
     r_user_priv on nccsiuser.uid = r_user_priv.uid) as mytemp
     ERROR at line 4:  ORA-01747:invalid user.table.column,table.column,or column specification;

    我确保数据库中的表nccsiuser,r_user_priv都存在.
    我自己的浏览器里能看到帖子的图。如果还有朋友看不到图,我就没辙了。
      

  5.   

    --语法错误
    create or replace view view_user_priv
    as 
    select a.username,b.privname 
    from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid) a
    right join nccsiprivilege b on a.pid =b.pid
      

  6.   

    create or replace view view_user_priv
    as select [mytemp].username, nccsiprivilege.privname from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid as [mytemp])
    right join nccsiprivilege on [mytemp].pid = nccsiprivilege.pid;
      

  7.   

    樓主運行一下下面三句:
    desc nccsiuser
    desc r_user_priv
    desc nccsiprivilege 
    把輸出結果貼出來看看
      

  8.   


    运行这个
    create or replace view view_user_priv
    as  
    select a.username,b.privname  
    from
    (select nccsiuser.username,r_user_priv.pid from nccsiuser right join
    r_user_priv on nccsiuser.uid = r_user_priv.uid) a
    right join nccsiprivilege b on a.pid =b.pid
      

  9.   

    谢谢各位朋友的热心帮助
    也不知道是什么原因,现在贴图出现问题
    请加我QQ 280477143,直接QQ里聊
    验证信息请注明 csdn的id号, 我好给分。