Re: comma-delimited export

From: Karen Payten <karen_at_metz.une.edu.au>
Date: 21 Jul 94 03:46:06 GMT
Message-ID: <5954_at_grivel.une.edu.au>


Robin Bowes (ROBIN_at_plato.ucsalf.ac.uk) wrote:
: I've recently had to get to grips with SQL again after a break of about 2
: years and I'm a bit rusty to say the least !
 

: I'd like to do a comma-delimited export from a query. Can anybody give me
: some tips on how to do this (sample code would be even better)?
 

: I'd like to strip out all the trailing space at the end of each field.
: For example:
: "<field>","<field>"
: rather than "<field> ","<field>"
 

: The main problem I'm having at the moment is getting rid of unwanted white
: space in-between the fields. For example:
 

: "<field>","<field>", <--- lots of space ---> "<field>",
 

: Can anyone help? My efforts so far are listed below.
 

: -----cut here--------------------------------------------------
<stuff deleted>

Robin,

Is the field c_length numeric? If so, then it is displayed using the default format. I found I needed to use to_char(c_length), which creates a field long enough for the number itself + 1 (for a sign).

Another thing I found was, if you are going to load this data using a merge facility, there tends to be a problem with the large amount of white space at the end of the last field (the set trim on is ignored during spooled output). I have needed to add ||'," " at the end of the data line, which effectively terminates the last field.

Regards Karen



Karen Payten
Database Administrator
Computing and Communication Services
University of New England, Armidale NSW
Email: karen_at_metz.une.edu.au Phone: +61 67 733549
Received on Thu Jul 21 1994 - 05:46:06 CEST

Original text of this message