Home » SQL & PL/SQL » SQL & PL/SQL » Carriage return in output
Carriage return in output [message #123885] Wed, 15 June 2005 07:06 Go to next message
sstellini
Messages: 32
Registered: April 2005
Location: Malta
Member
Hi guys,

does anyone know how to insert a carriage return in the HTML output?

I want to print the client names and address as one string, divided by carriage return and I tried this:

select FNAM1||' '||CD_SNAM1|| CHR(13) || CHR(10)
||ADD11|| CHR(13) || CHR(10)
||ADD12|| CHR(13) || CHR(10)
||ADD13|| CHR(13) || CHR(10)
||CITY || CHR(13) || CHR(10)
||COUNTRY "Address" 
from client


When I re-direct the output to HTML file, I don't get what I was looking for, ie the string appears in one line, rather than in 5.

I didn't find anything else usefull elsewhere, so my best chance is you guys (and girls of course!).

Sonja
Re: Carriage return in output [message #123899 is a reply to message #123885] Wed, 15 June 2005 08:41 Go to previous messageGo to next message
joy_division
Messages: 4490
Registered: February 2005
Location: East Coast USA
Senior Member
col cd_snam1 newline
col add11 newline
col add12 newline
col add13 newline
col city newline
col country newline

select cd_snam1,add11,add12,add13,city,country
from client
/
Re: Carriage return in output [message #123910 is a reply to message #123899] Wed, 15 June 2005 09:08 Go to previous messageGo to next message
sstellini
Messages: 32
Registered: April 2005
Location: Malta
Member
Hi,

well, it didn't work for me - the name and address are displayed in separate columns, which is not what I wanted.
I wanted them displayed in one column but separated by carriage return (so it is easy to copy and paste to a word doc).

thanks anyway..
Sonja
Re: Carriage return in output [message #123920 is a reply to message #123910] Wed, 15 June 2005 09:54 Go to previous messageGo to next message
Ronald Beck
Messages: 121
Registered: February 2003
Senior Member
HTML ignores carriage returns and multiple white space between information. If you want to put information on the next line, you need to enter the <br> command. So, you should have something like...

select FNAM1||' '||CD_SNAM1||'<br>'
||ADD11||'<br>'
||ADD12||'<br>'
||ADD13||'<br>'
||CITY ||'<br>'
||COUNTRY "Address"
from client

So try that and see how it works.

Ron
Re: Carriage return in output [message #123931 is a reply to message #123885] Wed, 15 June 2005 11:01 Go to previous messageGo to next message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
Other options you may want to investigate (possibly for future needs) include some of the sqlplus settings such as:

colsep
markup html
recsepchar
Re: Carriage return in output [message #124063 is a reply to message #123931] Thu, 16 June 2005 03:33 Go to previous message
sstellini
Messages: 32
Registered: April 2005
Location: Malta
Member
Ron,
for some reason that didn't work.
What worked out was this (thanks Smartin for the reference):

SET MARKUP HTML PREFORMAT ON
SET COLSEP '<br>'

select FNAM1||' '||CD_SNAM1 "Name",
ADD11, ADD12, ADD13, CITY, COUNTRY
from client


Thanks to all of you,
Sonja
Previous Topic: Alter session problem
Next Topic: PL/SQL stored procedure and Java stored procedure, which one is better
Goto Forum:
  


Current Time: Wed Jul 30 04:49:04 CDT 2014

Total time taken to generate the page: 0.10621 seconds