In Oracle database, there are many ways to query table names. Here are some common query methods.
SELECT
command to queryYou can use theSELECT
command in SQL to query the table name. The specific syntax is:
SELECT table_name FROM user_tables;
Among them,table_name
is the name of the table you need to query,user_tables
is the system table that comes with the Oracle system, used to store the current user All table information below.
For example, if you want to query whether a table namedorders
exists, the command is as follows:
SELECT table_name FROM user_tables WHERE table_name = 'orders';
If the table exists, the table nameorders# will be output. ##;If the table does not exist, there will be no output.
command to query the
DESCRIBEcommand is a command provided by Oracle for querying the table structure. You can use This command views column names, data types, lengths and other information in all tables. At the same time, this command can also query the table name. The specific syntax is:
DESCRIBE table_name;
ordersexists, the command is as follows:
DESCRIBE orders;
View query
ALL_TABLESThe view is a view that comes with the Oracle system and is used to query the current user All table information below, including table name, table space name, owner and other information. You can query the table name through the following command:
SELECT table_name FROM all_tables WHERE owner = <用户名称>;
owneris the user name to be queried. You can query all table information under the current user without adding this condition.
SELECT table_name FROM all_tables;
SCOTT, the command is as follows:
SELECT table_name FROM all_tables WHERE owner = 'SCOTT';
The above is the detailed content of oracle query table name. For more information, please follow other related articles on the PHP Chinese website!