I have a table “Orders” and needs to retrieve all it’s column names using an sql query. I know how to describe a table but i don’t want it from describe I want to list them using SQL query.
I there a table holds those information’s in Oracle?
Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To get the list of columns of a table in Oracle, we use to query the view “USER_TAB_COLUMNS” to get the columns of the tables or views owned by the current user. Or use the other view “USER_TAB_COLS“.
in the above query, we selected 7 columns to retrieve the most important information that you might be looking for in table columns which are
Note: you have to specify the table name parameter in uppercase.
Note 2: If you use the above view, you will get all unhidden columns, but if you query the view “USER_TAB_COLS” you will get all columns, including hidden columns.
Another view is “ALL_TAB_COLUMNS” this one is the same as “USER_TAB_COLUMNS” except that the “ALL_TAB_COLUMNS” view has a column called “OWNER” in which you can specify the owner of the table that you want to get its columns list.