ITPub博客

首页 > 数据库 > Oracle > ORA-00942问题处理

ORA-00942问题处理

原创 Oracle 作者:stonebox1122 时间:2017-05-18 18:02:36 0 删除 编辑
开发的同事反馈,创建了表,且在PL/SQL Developer中可以看到该表,但是执行查询操作却报“ORA-00942: table or view does not exist”错误。结果发现原因是创建表的脚本中表名使用双引号引起来了,而查询的时候也是需要双引号引起来才行的。

测试如下:
SQL> create table test1(id number);

Table created.

SQL> select * from test1;

no rows selected

SQL> select * from TEST1;

no rows selected

SQL> select * from TEst1;

no rows selected

可以看到,创建表的时候不使用双引号引起来,则表名是不区分大小写。

SQL> create table "test2"(id number);

Table created.

SQL> select * from test2;
select * from test2
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> select * from "TEST2";
select * from "TEST2"
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> select * from "test2";

no rows selected

可以看到,创建表的时候使用了双引号引起来,则表名是区分大小写的,且在使用的时候必须使用双引号。
有的工具,如PowerDesigner,生成的建表语句默认带有双引号,故建议为了后续使用方便,需要将双引号去掉再执行。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28536251/viewspace-2139303/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-12-13

  • 博文量
    204
  • 访问量
    1188946