Home » SQL & PL/SQL » SQL & PL/SQL » carriage returns in fixed-length records
carriage returns in fixed-length records [message #39001] Wed, 05 June 2002 13:28 Go to next message
Bill Trowsdale
Messages: 9
Registered: April 2002
Junior Member
Hi - I'm trying to create fixed-length records. I know
most of the things I need to know except for one.

this statement should be 295 characters long:

select RPAD(LAST_ACTION_BY,40)||RPAD(COMMENTS,255)
from .....

However, in our system, users can enter carriage
returns in the COMMENTS field. When they do, a piece
of the comment goes to another line in my fixed-length
file.

Any idea how to get around this?

Thanks,

Bill
Re: carriage returns in fixed-length records [message #39002 is a reply to message #39001] Wed, 05 June 2002 14:13 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
You can REPLACE the carriage returns with NULL (eliminating them). Just use whatever combination is appropriate for your carriage return (chr(10), chr(13), or chr(13)||chr(10)).

select RPAD(LAST_ACTION_BY,40)||RPAD(replace(COMMENTS, chr(10)),255)
Previous Topic: Migartion from Oracle 7 to 8 causes errors with to_char
Next Topic: I need an SQL statement for this...
Goto Forum:
  


Current Time: Thu Apr 25 19:12:58 CDT 2024