I am running some queries on an Oracle DB from my java program. Once a certain table is selected this query runs and returns some traits for the user.
A simplified version of my code as follows.
String query = "SELECT column_name, data_type, data_length FROM all_tab_columns WHERE table_name = 'blahblah'";
String ColumnName;
String DataType;
String DataLength;
System.out.println(ColumName);
System.out.println(DataType);
System.out.println(DataLength);
I am unsure as to what data_length is returning.
Is it returning the length of the data in the field? Or is it returning the max value. After some searching I have come across conflicting opinions. And when comparing the data type I get with its associated length it seems that it could be the max length but who knows maybe the field is just maxed out?
For Example:
Data Type = Number is returning Data Length = 22
Data Type = VARCHAR2 is returning Data Length = 2000
Bonus: (+5 points on final grade, and 1 free absence from class)
How could I change the query to get the data I dont have. (actual data length, or max data length).