ORA-00942: Can select from “schema.table” but not “table”?

前端 未结 3 1905
无人及你
无人及你 2020-12-19 17:03

I experienced an ORA-00942 (\"table or view does not exist\") when executing

select * from brunch

However, no such problem when executing

3条回答
  •  再見小時候
    2020-12-19 17:22

    I found that the table I was referencing (Flyway's schema_version table), was created with double quotes... and thus needed double quotes wherever it was referenced.

    Here's what Oracle says:

    A quoted identifier begins and ends with double quotation marks ("). If you name a schema object using a quoted identifier, then you must use the double quotation marks whenever you refer to that object.

    In practice, these worked:

    SELECT * FROM MYSCHEMA."schema_version";
    SELECT * FROM "MYSCHEMA"."schema_version";
    

    When this didn't (-> ORA-00942: table or view does not exist):

    SELECT * FROM MYSCHEMA.schema_version;
    

提交回复
热议问题