Subject Re: Newlines etc. in string literals
Author malte_starostik
--- In, Helen Borrie <helebor@t...>
> At 12:09 PM 7/08/2003 +0000, you wrote:
> >Hi,
> >
> >I've been trying in vain to find a way to insert a string
> >newlines into a varchar field with a plain SQL script (it's
> >generated, can't use parameters here).

> Have you tried concatenating it into your string literal using the
> ascii_char??
> update atable
> set funnychars = 'blah'||ascii_char(13)||ascii_char(10)||'blah'
> where....;

Thank you so much, this worked like a charm (\r\n vs. \n isn't an
issue for me luckily).
Although I needed to use 'blah'||substr(aschii_char(13),1,1)||substr
(ascii_char(10),1,1)||'blah' or it would truncate anything after the
first ascii_char(). Is this a known issue?

Actually I've used this approach before when inserting graphics into
BLOB fields via a generated script that reads the graphics from
files. For that I wrote a UDF that takes a base64 encoded string and
returns a BLOB. Any interest in including base64 codec UDFs into
fb_udf? I've got the decoding part working already.