Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Inserting a ' in a VARCHAR
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
Chris Received on Wed Jun 07 2000 - 00:00:00 CDT
![]() |
![]() |