On 15 September 2011 13:48, stefaan <[email protected]> wrote:

> > How do I escape the ' after the second '2' in this query?
>
> Do you really want only one ' to appear ? (my chemistry is a little
> rusty):
>

It is not a case whether I want it there.  It is there somewhere in the
database and I have to handle it.   'Somestring'  comes from a field in
another table.


> you can escape a single quote using a backslash:
>
> s = lower('2,2\'-(Butane-1,4-diyl)dibenzimidazolium dichloride')
>

Problem: I don't know when and where this would appear.  I am selecting
thousands of records and this was one of them.

>
> or alternatively, enclose the string in " " instead:
>
> s = lower("2,2'-(Butane-1,4-diyl)dibenzimidazolium dichloride")
>
> The query is passed directly to postgres.  Double quotes cannot be used in
lower() which is a postgresql-function.


Thanks for you reply.

Regards
Johann

-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
                                                    2 Pet. 1:2b,3a

Reply via email to