Home » SQL & PL/SQL » SQL & PL/SQL » embedding a carriage return into a varchar2 field
embedding a carriage return into a varchar2 field [message #7462] Mon, 16 June 2003 08:24 Go to next message
Julie Zolnowski
Messages: 9
Registered: April 2002
Junior Member
I would like to take the following output:
First Name: Sam Last Name: Smith

and embed a carriage return between 'Sam' and 'Last'
So that my output text looks as follows:

First Name: Sam
Last Name: Smith

How can I accomplish this? Thanks - Julie
Re: embedding a carriage return into a varchar2 field [message #7463 is a reply to message #7462] Mon, 16 June 2003 08:46 Go to previous message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
quote from Julie Zolnowski:
----------------------------------------------------------------------
I would like to take the following output:
First Name: Sam Last Name: Smith

and embed a carriage return between 'Sam' and 'Last'
So that my output text looks as follows:

First Name: Sam
Last Name: Smith

How can I accomplish this? Thanks - Julie

----------------------------------------------------------------------
Julie,

If you're on UNIX, then embed a CHR(10):
SQL> SELECT 'First Name: Sam' || CHR(10) || 'Last Name: Smith' text
  2  FROM   DUAL
  3  /
  
TEXT
--------------------------------
First Name: Sam
Last Name: Smith
  
  
SQL> 
If you're on Windows, then do the same, only use CHR(13) || CHR(10) instead.

HTH,

A
Previous Topic: database trigger before delete
Next Topic: Item Update
Goto Forum:
  


Current Time: Thu Apr 25 12:27:49 CDT 2024