Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Line wrapping with PL/SQL.

Re: Line wrapping with PL/SQL.

From: Raj <raj.kothary_at_thus.net>
Date: Tue, 17 Jan 2006 18:36:01 -0000
Message-ID: <dqjdak$miq$1$830fa17d@news.demon.co.uk>


"William Robertson" <william.robertson_at_bigfoot.com> wrote in message news:1137521276.355275.98270_at_o13g2000cwo.googlegroups.com...
> Raj wrote:
>> Hi,
>>
>> Can I ask if there is a good way of wrapping lines of text in PL/SQL?
>>
>> I'd like to be able to write a function which reads a file and puts the
>> text
>> contents into a varchar2. But, I want this to be the body of an email so
>> I'd like to make sure that the lines wrap so that there is no line longer
>> than 72 characters, but obviously not in the middle of a word.
>>
>> I'd really like any pointers for this as so far all I have done is got
>> the
>> file opena dn read the contents in line-by-line.
>>
>> Thanks in advance for your help (and apologies if this is the wrong group
>> to
>> post this to! If it is, where should I go?)
>>
>> Kind regards,
>> --
>> Raj Kothary :: one|concept
>
> You could try adapting the line wrapper I wrote for DBMS_OUTPUT, which
> is somewhere in this package:
> http://www.williamrobertson.net/code/utilities.pkg.txt
>
> I wrote it ages ago and haven't used it for a while, but it might give
> you some ideas.

Thanks William, I guess I could do something along the lines of:

  1. Suck in the contents of a file into a varchar2
  2. Split the varchar2 into "tokens" that are space-delimited
  3. Construct a new varchar2, by adding the tokens
  4. Add a carriage-return-line-feed when I get to the desired length of the line (without going over by adding the next token)

Is this what you had in mind?

A follow-up question is that if I was to send this email many times daily, would it be efficient to do it this way? Or should I just hard-code (yuk!) the email text in the package I am using to send it?

Many thanks
Raj Received on Tue Jan 17 2006 - 12:36:01 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US