Query oracle table Field Information

Source: Internet
Author: User

Querying oracle table field information can be called metadata. Someone asked how to export the table field information today. To tell the truth, I will not use plsql develper to export the table structure, as shown in: When writing a Database Design Manual, you want to copy the table to get twice the result with half the effort. You don't have to copy and paste the table one by one, and reduce the probability of errors, but unfortunately, this interface does not seem to support full selection and multi-choice, and cannot be copied as a whole. Maybe plsql develper has this function, but I still don't know it, but oralce is the most powerful data storage mechanism, metadata must be well done, so there must be an alternative to this problem. After a period of experimentation, you can meet the basic requirements:

[SQL] select t. table_name, t. column_name, c. DATA_TYPE, c. DATA_LENGTH, t. comments from USER_COL_COMMENTS t, USER_TAB_COLUMNS c where c. column_name = t. column_name and c. TABLE_NAME = 'config _ db' and c. TABLE_NAME = t. TABLE_NAME

 

The result is as follows: You can see that multiple selections and copies are supported, and the information here is the same, which can meet our requirements. To write the Data Length and Data Type together, you can use the following improved version:
[SQL] select t. table_name, t. column_name, c. DATA_TYPE | '(' | c. DATA_LENGTH | ')', t. comments from USER_COL_COMMENTS t, USER_TAB_COLUMNS c where c. column_name = t. column_name and c. TABLE_NAME = 'config _ db' and c. TABLE_NAME = t. TABLE_NAME

 

Effect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.