set serveroutput on
set autoprint on create or replace view StuSubScore as
select Stu.Stuid,stu.stuName,Sub.SubId,sub.SubName,Sc.Score
from Student stu,subject Sub,Score SC
where Stu.StuId=Sc.Stuid and Sc.SubjectID=Sub.SubID
/
视图已建立
select * from stusubscore;SQL> select * from stusubscore;
select * from stusubscore
                        *
ERROR 位于第 1 行:
ORA-01722: 无效数字已建立怎么还查不到呢?

解决方案 »

  1.   

    好像select * from stusubscore; 语句有问题,将*改成具体的字段名,再试试。
      

  2.   

    select Stu.Stuid,stu.stuName,Sub.SubId,sub.SubName,Sc.Score
    from Student stu,subject Sub,Score SC
    where Stu.StuId=Sc.Stuid and Sc.SubjectID=Sub.SubID
    执行可报错 ?
      

  3.   

    ORA-01722   invalid   number   
        
      Cause:   The   attempted   conversion   of   a   character   string   to   a   number   failed   because   the   character   string   was   not   a   valid   numeric   literal.   Only   numeric   fields   or   character   fields   containing   numeric   data   may   be   used   in   arithmetic   functions   or   expressions.   Only   numeric   fields   may   be   added   to   or   subtracted   from   dates.   
        
      Action:   Check   the   character   strings   in   the   function   or   expression.   Check   that   they   contain   only   numbers,   a   sign,   a   decimal   point,   and   the   character   "E"   or   "e"   and   retry   the   operation.
      

  4.   

    虽然你看到某个字段的数据都是数字,但有可能这个字段实际是字符型的,
    有的记录这个字段也存在字符型数据,这时你要是用这个字段和数值比较时会报错。
    desc your_table看一下
      

  5.   

    stu 和Stu不知道区不区分大小写,你试试吧。
      

  6.   

    首先确保
    select Stu.Stuid,stu.stuName,Sub.SubId,sub.SubName,Sc.Score
    from Student stu,subject Sub,Score SC
    where Stu.StuId=Sc.Stuid and Sc.SubjectID=Sub.SubID
    能够查询然后再找原因
      

  7.   

    与视图相关的两个表中的字段可能有变化,需要重新编译这个视图。
    就是把create or replace view StuSubScore as这一段重新执行一下,再看看。