「Oracle」 sql语句查询报错ORA-00904

「Oracle」 sql语句查询报错ORA-00904

技术教程gslnedu2025-03-17 17:00:086A+A-

Oracle报错ORA-00904: 标识符无效

一般情况下,标识符错误是因为:语句中的列名在表中不存在,修改sql语句或者修改列名即可。



特殊情况:

正常建表语句如下:

create table student(

id int,

name varchar2(100)

);

但是如果建表语句写成了:

create table student(

"id" int,

"name" varchar2(100)

)

若给列名加了双引号,表的列名查看时仍然为:id,name。 但是,若使用如下查询语句则会报错:

select id,name from student;

ORA-00904:标识符无效



这种情况查询语句应该为:

select "id","name" from student t where "name" = "xxx";
作为查询条件时必须是双引号,单引号不报错但是查询结果为空。

点击这里复制本文地址 以上内容由朽木教程网整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
qrcode

朽木教程网 © All Rights Reserved.  蜀ICP备2024111239号-8