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: String literals in PL/SQL

Re: String literals in PL/SQL

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 12 Sep 2003 11:28:27 -0700
Message-ID: <92eeeff0.0309121028.79057716@posting.google.com>


Steve Holdoway <steve_at_itemfront.ltd.uk> wrote in message news:<nil3mv46t396752jc6anlc7kti8aattsov_at_4ax.com>...
> On Thu, 11 Sep 2003 18:11:19 GMT, Richard Kuhler <noone_at_nowhere.com>
> wrote:
>
> >Michael Young wrote:
> >> How does one embed line feeds into a string literal?
> >> Can a string literal be "broken up" in multiple string literals?
> >>
> >> Basically, I'm trying to create table comments. The syntax is
> >>
> >> comment on table <table name> is '<comment text>'
> >>
> >> The comment text must be a string literal. The comments I want to
> >> generate really are best formatted into a few lines, so I want to
> >> include line feeds in the string literal itself. Alas, I haven't
> >> figured out how...
> >> Also, since the comment text can get fairly long, I'd like to break up
> >> the string literals over several lines so that the comment is readable
> >> in the source script using a standard editor (without resorting to
> >> scrolling). In 'C', two adjacent string literals separated by white
> >> space are automatically concatentated, but this is not the case in
> >> PL/SQL. Again, how to do anything like this eludes me...
> >> Of course, I might be able to accomplish the desired results by using
> >> dynamic SQL, but I'd like to avoid that avenue, if possible.
> >
> >I'm confused, you say you're doing this in PL/SQL without using dynamic
> >SQL? Can you show us how you did that?
> >
> >I'm guessing that you're actually doing this in a SQL*Plus script. In
> >that situation you can just put the new line right in without closing
> >the quotes. For example ...
> >
> >comment on table t is
> >'this is line one
> >this is line two
> >this is line three'
> >/
> >
> >Note: white space at the beginning of those lines will be preserved so
> >you won't want to indent that text.
>
> comment on table t is 'This is line 1' || chr (12) || 'this is line 2'
> ||...
>
> Should work, otherwise use CrLf as chr(12) || chr (10)
>

It should be CHR(13) for Carriage Return.

Regards
/Rauf Received on Fri Sep 12 2003 - 13:28:27 CDT

Original text of this message

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