[SQL][ORACLE] List of fields
Solved
masterdim
Posted messages
55
Status
Membre
-
x -
x -
Hello everyone,
I have a little problem, I would like to build a query that returns the list of fields from a table.
I can do it in MySQL:
DESCRIBE tableName;
I can do it in MSSQL:
SELECT column_name as Field
FROM information_schema.columns
WHERE table_name = 'tableName';
But I don't know how to do it in ORACLE :-(
I've tried and none of the two methods above work...
Thank you for your help!
Dim.
I have a little problem, I would like to build a query that returns the list of fields from a table.
I can do it in MySQL:
DESCRIBE tableName;
I can do it in MSSQL:
SELECT column_name as Field
FROM information_schema.columns
WHERE table_name = 'tableName';
But I don't know how to do it in ORACLE :-(
I've tried and none of the two methods above work...
Thank you for your help!
Dim.
10 réponses
Hello,
You need to look for the information in the dictionary.
Use the command:
Select COLUMN_NAME from USER_TAB_COLUMNS where TABLE_NAME = <your table name>
Example:
Select COLUMN_NAME from USER_TAB_COLUMNS where TABLE_NAME='Client'
To retrieve other information, you can replace COLUMN_NAME with:
DATA_TYPE
DATE_TYPE_MOD
DATA_TYPE_OWNER
You need to look for the information in the dictionary.
Use the command:
Select COLUMN_NAME from USER_TAB_COLUMNS where TABLE_NAME = <your table name>
Example:
Select COLUMN_NAME from USER_TAB_COLUMNS where TABLE_NAME='Client'
To retrieve other information, you can replace COLUMN_NAME with:
DATA_TYPE
DATE_TYPE_MOD
DATA_TYPE_OWNER
Thanks, but it doesn't work...
ORA-00911: invalid character
:-(