Forcing a Linefeed in SQL

Question:
How do I force a linefeed character using SQL? I created a report (see below) but when I e-mailed this report from Unix the carriage return was not interpreted correctly.

I want the results to look like the following:

Invoice Number: 123456
Order Number: 444422222
Customer Number: abc123

When I e-mail this file using elm (to Microsoft Outlook or cc:Mail), I get the following :

Invoice Number: 123456 Order Number:44422222 Customer Number: abc123

The line break is not recognized. Any thoughts??

Here’s the code:

set verify offset echo offset feedback offset linesize 30set space 0set heading offcolumn invoice_num format  fold_after 1column sales_ord_num format  fold_after 1column rapid_txn_id format  fold_after 1column launch_dt format  fold_after 1column inv_dt format  fold_after 1spool &1select  'Invoice Number    :  &1' invoice_num,        'Sales Order Number:  ', sales_ord_num,        'RAPID Txn Number  :  ',  oh.mepr rapid_txn_id,        'Order Date        :  ', to_char(oh.timestamp,'MM/DD/YY') launch_dt,        'Ship Date         :  ', to_char(inv_dt,'MM/DD/YY') inv_dtfrom    sales_ord so, inv_hdr inv, ord_hdr ohwhere   so.sales_ord_id = inv.sales_ord_id

Answer:
Hm, this looks like Oraclese… 🙂

I don’t know if this will work, but you might try sending a carriage return and line feed combination?like CHAR(10)+CHAR(13)?at the end of each column name. That may do it for you.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: