sqlplus format help
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: sqlplus format help

  1. #1
    Join Date
    Mar 2001
    Location
    south africa
    Posts
    401

    sqlplus format help

    set linesize 32000
    set pagesize 32000
    set trimspool on
    spool c:\dataset.txt
    select substr(column1,1,4) as column1,substr(column2,1,20) as column2,substr(column3,1,15) as column3,substr(column4,1,4) as column4 from table1;
    spool off

    but when i open its all wrapped.when i uncheck wordwrap its okay
    but why is there so much gap between column1 and column2 and so on.is there a way so that it will display as given in substr
    column1 column1 column1
    ---------------------------------------- -------------------- ------------


    thanks

  2. #2
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204
    add formatting to the top of your script.

    column column1 format a10

    RTM - that really helps too...

    Ken
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

  3. #3
    Join Date
    Mar 2001
    Location
    south africa
    Posts
    401
    thanks it's not working for number

    column1 is a datatype number

    it's not formatting they way i have given

    such as column column1 format 9999


    Also how to format a float column?

    any help is much appreciated

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Quote Originally Posted by prodadmin
    column1 is a datatype number
    Not after you've wrapped in in SubStr() it isn't, even if it is stored as a number in the database. Run DESCRIBE on the table to see what it really is, and if you want to use a numberic format on that column either embed it in a to_char() or leave it alone and use COLUMN to format it. My preference would be the latter
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Mar 2001
    Location
    south africa
    Posts
    401
    that was it ...

    thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width