Neo
Neo

Reputation: 696

User_tables Oracle

I have created several tables in Oracle but I can't find them using for example the query

select * from user_tables where table_name='temp';

But I'm sure the table temp does exist, I checked it.

Upvotes: 0

Views: 4063

Answers (2)

Mike
Mike

Reputation: 3311

The table name has to be in upper case in user_tables.

select * from user_tables where table_name='TEMP';

An example:

SQL> create table bogus (name varchar2(10));

Table created.

SQL> select table_name from user_Tables where table_name = 'bogus';

no rows selected

SQL> select table_name from user_Tables where table_name = 'BOGUS';

TABLE_NAME
------------------------------
BOGUS

*** This is an edit to explain a little of what what said in the comments section of this answer. In short, you can create lower/mixed case objects in Oracle, but the issue becomes having to wrap the object names in double quotes each time you reference them.

An Example

SQL> create table "bogus" (name varchar2(10));

Table created.

SQL> select table_name from user_tables where table_name = 'BOGUS';

no rows selected

SQL> select table_name from user_tables where table_name = 'bogus';

TABLE_NAME
------------------------------
bogus

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


SQL> select * from "bogus";

no rows selected

SQL>

Upvotes: 4

pksnj
pksnj

Reputation: 56

Try this:

select * from user_tables where upper(table_name)=upper('temp');

Upvotes: 0

Related Questions