Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6239211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:21:13+00:00 2026-05-24T11:21:13+00:00

I am running some queries on an Oracle DB from my java program. Once

  • 0

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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:21:13+00:00Added an answer on May 24, 2026 at 11:21 am

    It should be relatively easy to test. Note that there is no ALL_TABLE_COLUMNS view– there is an ALL_TAB_COLUMNS and an ALL_TAB_COLS view that provide this information. I’ll create an empty table and run the query I assume your professor intended.

    SQL> create table empty_table (
      2    col1 number(10,2),
      3    col2 varchar2(100),
      4    col3 varchar2(100 byte),
      5    col4 varchar2(100 char)
      6  );
    
    Table created.
    
    SQL>   select column_name, data_type, data_length
      2      from all_tab_columns
      3     where table_name = 'EMPTY_TABLE'
      4  order by column_name;
    
    COLUMN_NAME                    DATA_TYPE      DATA_LENGTH
    ------------------------------ -------------- -----------
    COL1                           NUMBER                  22
    COL2                           VARCHAR2               100
    COL3                           VARCHAR2               100
    COL4                           VARCHAR2               300
    

    Now that you’ve seen the actual result, it should be clear what length is being returned in the DATA_LENGTH column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long running program that exectues some mySQL-Queries every 5 minutes (timed
I have been messing with Oracle DB queries that run from my JAVA app.
I'm trying to update a table in Oracle and I'm running into some difficulty.
I am running some queries to track down a problem with our backup logs
I'm running some JMeter tests against a Java process to determine how responsive a
i'm going to running some queries against an SQL Server database, followed by a
I want to connect to Sql server and running some sql queries. How can
I noticed some queries were running quite slow all of the sudden. After running
I'm running SQL Server 2008, and trying to run some queries on some poorly
I'm trying to run some queries to a database from a pylons (paster-based) webserver

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.