Unanswered: How do I find the size of the field in SQL
I am working on a JDBC - Java program to make sure that data I am going to insert into a table coming from a file is not too long for the field in the given table. Is there a way in SQL to find that out? Thanks.
I know that the size of the field shows up if I type in "describe <tablename>" in the type column, but I want to get that by itself.
You can query the XXX_TAB_COLUMNS table where XXX is
which ever you have access to
here is an example of a query I use
SELECT Data_Type|| Decode(Data_Type,'DATE',null,Decode(Data_Precision,null, decode(data_type,'NUMBER',null,'('||data_length||')'), '('||Data_Precision||','||data_Scale||')'))
WHERE table_name = 'TABLENAME'
AND column_name = 'COLUMNNAME'
the decodes are used to grab the correct size information for the specific datatype