ORA-00942:表或视图不存在-Oracle [英] ORA-00942: table or view does not exist - Oracle
问题描述
我正在使用Oracle 11g 使用查询时出现此错误:
I'am using Oracle 11g I got this error when I use query:
select count(*) from potluck;
所以当我使用时:
select count(*) from "potluck";
一切都很好... 请告诉我为什么? 谢谢
every is okie... Please tell me why? Thank you
推荐答案
在Oracle中将双引号引起来会使Oracle将标识符视为区分大小写,而不是使用不区分大小写的默认值.如果创建的表(或列)的名称周围带有双引号,则必须始终使用双引号引用标识符,并正确指定大小写(所有大写标识符除外,其中双引号无意义) ).
Putting double-quotes around an identifier in Oracle causes Oracle to treat the identifier as case sensitive rather than using the default of case-insensitivity. If you create a table (or a column) with double-quotes around the name, you must always refer to the identifier with double quotes and by correctly specifying the case (with the exception of all upper case identifiers, where double-quotes are meaningless).
在幕后,Oracle始终在进行区分大小写的标识符匹配.但是,在进行匹配之前,它始终将未用双引号引起来的标识符强制转换为大写.如果在标识符两边加上双引号,则Oracle会跳过对大写字母的强制转换.
Under the covers, Oracle is always doing case-sensitive identifier matching. But it always casts identifiers that are not double-quoted to upper case before doing the matching. If you put double-quotes around an identifier, Oracle skips the casting to upper case.
所以,如果您做类似的事情
So if you do something like
CREATE TABLE my_table(
col1 number,
col2 number
)
可以
SELECT * FROM my_table
SELECT * FROM MY_TABLE
SELECT * FROM My_Table
SELECT * FROM "MY_TABLE"
但类似
SELECT * FROM "my_table"
将失败.
另一方面,如果您做类似的事情
On the other hand, if you do something like
CREATE TABLE "my_other_table"(
col1 number,
col2 number
)
你不能做
SELECT * FROM my_other_table
SELECT * FROM MY_OTHER_TABLE
SELECT * FROM My_Other_Table
SELECT * FROM "MY_OTHER_TABLE"
但是这个
SELECT * FROM "my_other_table"
将起作用
这篇关于ORA-00942:表或视图不存在-Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!