Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Inserting strings containing apostrophes
Darryl wrote:
>
> I'm using 8.1.7 Enterprise.
>
> The following insert statement fails because of the apostrophe after the
> word ticket:
>
> INSERT INTO TABLE ( VARCHAR2 column ) VALUES ('ticket's required');
>
> I can get around it by adding an extra apostrophe:
>
> INSERT INTO TABLE ( VARCHAR2 column ) VALUES ('ticket''s
> required');
>
> and the insert works. But that's not a workable solution for what I'm
> doing.
>
> Anybody have other ideas, like surrounding the string with escape
> characters, quotes, etc. I've tried several ways and can't get anything to
> work.
I don't know what you want to do, but maybe you should try
bind-variables.
The insert-statement would look like
insert into my_table( varchar_col )
values( :col_one );
This statement is to be parsed and then you can bind any value to the
bind-variable
:col_one ( don't forget the colon in front of the variable-name )
For further information look into your manual.
Hope that helps,
regards, Stephan
-- --------------------------------------------------------------- Dipl.-Inf. (FH) Stephan Born | beusen Solutions GmbH fon: +49 30 549932-0 | Landsberger Allee 366 fax: +49 30 549932-21 | 12681 Berlin mailto:stephan.born_at_beusen.de | Germany --------------------------------------------------------------- PGP-Key verfügbar | PGP-Key available ---------------------------------------------------------------Received on Thu Aug 30 2001 - 02:04:27 CDT
![]() |
![]() |