Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003

    Post Unanswered: Formmating SQL queries output...

    Dear all,

    I write UNIX shell script to invoke SQL*Plus to run SQL queries.
    The query results will be spooled to a file, i.e. the report.

    However, I found that the field length of a column in the report
    is the same as that in a db table, all the blanks are also output
    to the report. This wastes a lot of harddisk spaces.
    For example, if a text field is 256 characters long in the table,
    it will be also 256 characters long in the report,
    although there are only 20 characters of data, while others are blanks.
    This really wastes a lot of spaces and increases the report size greatly.

    I know only the "set trimspool on" command to trim the trailing blanks of a row.
    I am looking for a method to "trim" all the blanks in all columns.
    Please give me a helping hand.


  2. #2
    Join Date
    Mar 2002
    Reading, UK
    Just do select trim(col1 || ',' || col2 || ...) where col<n> are the column names and replace ',' with whatever delimiter you require.


  3. #3
    Join Date
    Apr 2003
    Greenville, SC (USA)
    I use the SQLPlus commands as such ...

    Attached Files Attached Files
    • File Type: sql 1.sql (1.3 KB, 35 views)

Posting Permissions

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