Total Pageviews

2015/05/07

[Oracle] How do I get column's data type in Oracle

Problem
If I have table name and column name, how do I get its data type in database?


Solution
Here is the sql statement to retrieve column's data type
1
2
3
4
SELECT DATA_TYPE
FROM all_tab_columns
WHERE upper(TABLE_NAME) = :TABLE_NAME
  AND upper(COLUMN_NAME) = :COLUMN_NAME


Execution result:



Reference
[1] http://stackoverflow.com/questions/2339053/how-do-i-get-column-datatype-in-oracle-with-pl-sql-with-low-privileges

No comments: