Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle get column data size

Tags:

types

oracle

I'm new to Oracle db, and i wonder if i can find out the datatype and datasize... I mean : let's say i have the column "location" of type varchar2(20) in table "products". Could i write a query that would return me in the result "varchar2" and "20" ?

Thank you!

like image 585
Marius Avatar asked Feb 12 '11 17:02

Marius


People also ask

How do I find the size of a column in SQL Developer?

If you only need to know it for your knowledge, typing desc tablename in SQLPlus will tell you about the columns in the table.

How do you find the maximum length of a column in Oracle?

SELECT MAX( LENGTH( air_carrier ) ) FROM flight; SELECT MAX( LENGTH( name ) ) FROM arpt; and so on. Hope this helps.


1 Answers

Check out user_tab_columns.

select data_type, data_length 
  from user_tab_columns
 where table_name = 'PRODUCTS'
   and column_name = 'LOCATION';
like image 84
Ronnis Avatar answered Sep 27 '22 18:09

Ronnis