Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: String literals in PL/SQL
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.
Richard Kuhler Received on Thu Sep 11 2003 - 13:11:19 CDT
![]() |
![]() |