Results 1 to 3 of 3

Thread: len

  1. #1
    Join Date
    Aug 2006
    Posts
    39

    Unanswered: len

    Hi, How do you get the length of a field in a table?
    Is it like:
    select len(fieldname) from tablename

  2. #2
    Join Date
    May 2004
    Location
    BA [ARG]
    Posts
    137
    Are you looking for the size of a column?
    Code:
    SELECT data_length FROM user_tab_columns
     WHERE table_name = 'your-table'
       AND column_name = 'your-column'
    Or for the length of a specific varchar2 column?
    Code:
    SELECT length(column) FROM table
    Last edited by DKG; 08-10-06 at 10:43.

  3. #3
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    You could always just "describe" the table:

    Code:
    SQL> DESCRIBE my_table;
    
    Name                   Null?    Type
    ---------------------- -------- -----
    COLUMN_1               NOT NULL VARCHAR2(10)
    COLUMN_2               NOT NULL NUMBER
    JoeB
    save disk space, use smaller fonts

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •