Re: Need escape character for apostrophe

842 views
Skip to first unread message

Thomas Mueller

unread,
Jun 19, 2012, 2:48:01 AM6/19/12
to h2-da...@googlegroups.com
Hi,

The escape character for an apostrophe is a single apostrophe, as in Oracle.

Regards,
Thomas

On Tue, Jun 19, 2012 at 7:44 AM, Guys <ni4...@gmail.com> wrote:
> Hello
>
> I have a table with a varchar2 column that should contain sql statement. The
> problem is that if the sql statement contains an apostrophe "'" then my
> insert statement fails.
> for example:
> insert into scripts (id,text) values (1,'select * from all_objects where
> status='INVALID'');  (note the double apostrophe at the end).
> I originally come from oracle, where you can escape this using three
> apostrophes (''') but it doesnt seem to work in H2.
>
> How can I escape the ' character in H2 ?
>
> Thanks
>
> Guy
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/W7CycwwFVa8J.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.

Guys

unread,
Jun 19, 2012, 6:37:32 AM6/19/12
to h2-da...@googlegroups.com
Hello

It worked, thanks (I was wrong when trying to use two aposthrophes...)

Guy


On Tuesday, June 19, 2012 9:48:01 AM UTC+3, Thomas Mueller wrote:
Hi,

The escape character for an apostrophe is a single apostrophe, as in Oracle.

Regards,
Thomas

> Hello
>
> I have a table with a varchar2 column that should contain sql statement. The
> problem is that if the sql statement contains an apostrophe "'" then my
> insert statement fails.
> for example:
> insert into scripts (id,text) values (1,'select * from all_objects where
> status='INVALID'');  (note the double apostrophe at the end).
> I originally come from oracle, where you can escape this using three
> apostrophes (''') but it doesnt seem to work in H2.
>
> How can I escape the ' character in H2 ?
>
> Thanks
>
> Guy
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/W7CycwwFVa8J.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
Reply all
Reply to author
Forward
0 new messages