Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Dumb Question, how to insert ' into varchar2 field
"Perm" <rhugga_at_yahoo.com> wrote:
>
>Don't ask why but I have a need to insert a ' symbol into a varchar2
>field. Replacing ' with something else is not option.
>
>I have tried escaping it:
>
>insert into user.table values ( 'some text containing \'. some more
>text' )
>
>Oracle complains about the ' symbol (ORA-00917).
>
>What is the proper way to 'escape' this symbol so I can store it into a
>varchar2 field?
>
>much thx
If you are creating the text you can use the CHR function like this:( CHR(39) is the ' character..)
insert into user.table values ('text followed by ' || CHR(39) || ' and then more text') Received on Tue Feb 15 2005 - 10:54:25 CST