I am using Oracle 11g and Oracle SQL Developer 3.2.20.09. I am creating a procedure.
Why is it that I get an error PL/SQL: ORA-00942: table or view does not exist when I write the query like this:
select * from TableExample;
But if I write the query like this:
select * from "TableExample";
it works fine?
Is there a way to use the first option without errors? Note that the table was created using the same user that is executing the query above.
EDIT: I’ve also noticed that I have to use apostrophes for every field, EXCEPT the primary key ID
The reason is that the table was created with the table name in double quotes. Usually, table and column names are case insensitive, but if you put double quotes around them, they become case sensitive UNLESS they are completely in upper case (insane, but true 🙁 ).
To find the correct table and column names, you can query the data dictionary:
(if you don’t have the necessary rights, use user_tab_cols instead of dba_tab_cols).
For each table name and column name returned by this query, if it contains anything but uppercase characters or underscores, you’ll have to quote it.