Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: HOWTO: quote a '
Hi Carsten,
If you're inserting a string with an embedded single quote, just add another single quote beside it, like this:
SQL> insert into test_customer
2 values(229,'http://hiworld''s');
1 row created.
SQL> select * from test_customer;
228 FITNESS FIRST 229 http://hiworld's
34 rows selected.
SQL> commit;
Commit complete.
Hope this helps.
Steve
In article <3A34C892.26AB492E_at_tool42.com>,
Carsten Jacobs <carsten.jacobs_at_tool42.com> wrote:
> This is a multi-part message in MIME format.
> --------------3ACEF0B9D003510BF6AEE0B1
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hi
> I have an insert statement which is dynamically created
> and executed with EXECUTE IMMIDAITE
> in a stored procedure. One of the values contains an url
> which comes from an cursor fetched into a variable.
>
> Sometimes the url contains a single quote (') and the dynamic insert
> statement crashes.
>
> The statement looks like
> INSERT INTO table VALUES( 1, 'http://helloworld.com/';return%20true' )
>
> So the problem is 'http://helloworld.com/';return%20true'
> =
>
> Do I have to parse the url before and replace occurances of '
> or is there another way?
>
> Carsten
> --------------3ACEF0B9D003510BF6AEE0B1
> Content-Type: text/x-vcard; charset=us-ascii;
> name="carsten.jacobs.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Card for Carsten Jacobs
> Content-Disposition: attachment;
> filename="carsten.jacobs.vcf"
>
> begin:vcard
> n:Jacobs;Carsten
> tel;fax:+49 (0)/30.24748.200
> tel;work:+49 (0)/30.24748.140
> x-mozilla-html:FALSE
> url:www.tool42.com
> org:tool42.com AG;Research & Development
> version:2.1
> email;internet:carsten.jacobs_at_tool42.com
> adr;quoted-printable:;;Singerstr. 109=0D=0A;Berlin;;10179 ;Germany
> fn:Carstens Jacobs
> end:vcard
>
> --------------3ACEF0B9D003510BF6AEE0B1--
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Dec 11 2000 - 10:42:17 CST