Home > Database > Mysql Tutorial > How Do I Retrieve Column Names from an Oracle Table?

How Do I Retrieve Column Names from an Oracle Table?

Barbara Streisand
Release: 2025-01-24 17:46:11
Original
997 people have browsed it

How Do I Retrieve Column Names from an Oracle Table?

How to retrieve the name from the Oracle table?

In Oracle 11G and higher versions, you can use the table to get the name of the table owned by the current user. For tables owned by all users, use

or

table. USER_TAB_COLS ALL_TAB_COLS Example query DBA_TAB_COLS

To exclude some columns and the specified mode of the 'users' table, you can use the following inquiries:

Note:

Table names and columns are usually represented in an uppercase form in Oracle. Please make sure that your inquiries are also used in capital.

<code class="language-sql">SELECT column_name
FROM all_tab_cols
WHERE table_name = 'USERS'
  AND owner = '<schema_name>'
  AND column_name NOT IN ('PASSWORD', 'VERSION', 'ID')</code>
Copy after login
Table space and mode

In Oracle, the table space and mode are not the same. The table space refers to the physical storage location of the table, and the pattern is the logical group of the database object owned by the user or the character. Therefore, you don't need to specify the table space name in the query.

The general HQL equivalent effect

The above Oracle query does not have direct HQL equivalent items. However, you can use

and

annotations in JPA to specify the pattern and columns to be eliminated.

The above is the detailed content of How Do I Retrieve Column Names from an Oracle Table?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template