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: 无效数字已建立怎么还查不到呢?
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: 无效数字已建立怎么还查不到呢?
from Student stu,subject Sub,Score SC
where Stu.StuId=Sc.Stuid and Sc.SubjectID=Sub.SubID
执行可报错 ?
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.
有的记录这个字段也存在字符型数据,这时你要是用这个字段和数值比较时会报错。
desc your_table看一下
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
能够查询然后再找原因
就是把create or replace view StuSubScore as这一段重新执行一下,再看看。