Subject Re: [firebird-support] An alternative for ASCII_CHAR() ?
Author Mark Rotteveel
On 04 Jun 2015 00:10:14 -0700, "brucedickinson@... [firebird-support]"
<firebird-support@yahoogroups.com> wrote:
> Hello,
>
> I need to produce delimited text output from my stored procedure, for
> example:
>
> 23;65;some text;
>
> The thing is that semicolon ";" might appear in one of the delimited
> fields and this will cause some bugs on the client side. So I want to
> change this character to a less common one. I've decided to use ASCII 7
- a
> "Bell" character.
>
> I am afraid that usage like this:
>
> DECLARE V_OUTPUT VARCHAR(1024);
> DECLARE V_PARAM VARCHAR(32);
> ...
>
> V_OUTPUT = V_OUTPUT || ASCII_CHAR(7) || V_PARAM;
>
> will slow down my query because I will be doing a lot of concatenations.
> Correct me if I am wrong but I think that even if I put this code into
> stored procedure, ASCII_CHAR(7) will not be resolved at compile time and
> will be called over and over again?
>
> Is there other way to put my character directly into the query? For
> semicolon that was easy:
>
> V_OUTPUT = V_OUTPUT || ';' || V_PARAM;
>
> but how to do this with a Bell character?

You might be able to use binary string literals:
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-hexbinstrings.html

Mark