How to Insert a Carriage Return in the Middle of a Select Statement (Doc ID 274305.1)

Last updated on AUGUST 11, 2017

Applies to:

SQL*Plus - Version 8.0.6.0 and later
Information in this document applies to any platform.

Goal

Trying to do a long select that will ultimately result in 3 lines of output separated by carriage returns.

For Example:

Select 'D',val1, val2, '^M', 'F',val1, val3,'^M','A',val1,val4,'^M'
from value_table.

Pipes will be used instead of comma delimiters and the output will need to be looked like this:

D|val1|val2|valx|
F|val1|val3|valx|
A|val1|val4|valx|

 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms