SQL> create view v$_dept_avg_sal_info as
  2  select deptno, avg_sal, grade from
  3  ( select deptno, avg(sal) avg_sal from emp group by deptno ) t
  4  join salgrade s on ( t.avg_sal between s.losal and s.hisal);
join salgrade s on ( t.avg_sal between s.losal and s.hisal)
     *
第 4 行出现错误:
ORA-00942: 表或视图不存在

解决方案 »

  1.   

    有啊,不信你敲一下 select * from salgrade
      

  2.   

    SQL> select deptno, grade, avg_sal from
      2  ( select deptno, avg(sal) avg_sal from emp group by deptno ) t
      3  join salgrade s on ( t.avg_sal between s.losal and s.hisal );    DEPTNO      GRADE    AVG_SAL
    ---------- ---------- ----------
            10          4 2916.66667
            20          4       2175
            30          3 1566.66667SQL> conn sys/bjsxt as sysdba;
    已连接。
    SQL> grant create table,create view to scott;授权成功。
    SQL> create view v$_dept_avg_sal_info as
      2  select deptno,grade,avg_sal from
      3  ( select deptno, avg(sal) avg_sal from emp group by deptno ) t
      4  join salgrade s on ( t.avg_sal between s.losal and s.hisal);
    join salgrade s on ( t.avg_sal between s.losal and s.hisal)
         *
    第 4 行出现错误:
    ORA-00942: 表或视图不存在