Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Inserting a ' in a VARCHAR

Re: Inserting a ' in a VARCHAR

From: Bill <brinderknecht_at_austin.rr.com>
Date: 2000/06/07
Message-ID: <klz%4.17640$Gh.196874@typhoon.austin.rr.com>#1/1

Another approach may be to use two single quotes. i.e. '' . It works well for me. BTW if you use CHR() be pay attention to your character set. Especially with international apps.

"Chris Hamilton" <toneczar_at_bellatlantic.net> wrote in message news:393eb0c1.21840665_at_news.erols.com...
> On Wed, 07 Jun 2000 19:59:11 GMT, "Joe Patterson"
> <jpatterson_at_elitra.com> wrote:
>
> >How does one include a ' (single quote, apostrphy) directly into a
 VARCHAR?
> >Is there a way to escape the quote like \' or something? I want to avoid
> >converting the ' to a work like prime or apostrophy.
> >
> >Anyone know how to do this?
>
> I think an easy way is to convert it to a ASCII code function. The
> Oracle CHR() function can accomplish this when fed the required ASCII
> value.
>
> For instance,
>
> SQL> select chr(39) from dual;
>
> C
> -
> '
>
> So, you could do this:
>
> insert into table_x
> (col_1)
> values
> ('My name is Troy O' || chr(39) || 'Leary');
>
> SQL> select * from table_x;
>
> COL_1
> ----------------------------------------
> My name is Troy O'Leary
>
>
> Chris
Received on Wed Jun 07 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US