Subject Re: [firebird-support] How to handle ' in execute statement
Author Svein Erling Tysvaer
Hi Paul!

I never even knew that 1.5.3 dialect 1 supported execute statement! But
let's consider what you want:

select surname from patient where surname containing ''''

is the string you want in your sql. To represent this, I would expect
you to have to double each of them, so I would expect the statement you
are looking for to be:

sql=' select surname from patient where surname containing ''''''''';
(i.e four pairs of single quotes + the terminating single quote)

Though I've never tried anything like this, so it may not work...

Set

Paul Hope wrote:
> Hi
>
> V 1.5.3 dialect 1
>
> I have an SQL statement like
>
> --> select surname from patient where surname containing ''''
>
> works fine - returns the O'Rielly types.
>
> but in a stored procedure
>
> sql=' select surname from patient where surname containing ' ' ';
> (one pair of 's) (spaces inserted for clarity)
> or
> sql=' select surname from patient where surname containing ' ' ' ' ' ;
> (two pairs of 's)
> or
> sql=' select surname from patient where surname containing ' ' ' ' ' ' '
> ; (three pairs of 's)
> or
> sql=' select surname from patient where surname containing " ' ' " ';
> (double ", pair of 's, double ")
> or
> sql=" select surname from patient where surname containing ' ' "; (whole
> thing using double " with single 's inside)
>
> for execute statement sql do . . . fails because non of the above are
> equivalent to -->
>
> is there a combination that should work?
>
> Regards
> Paul