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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Nested speech marks in sql insert

Re: Nested speech marks in sql insert

From: Steve A <spectre_at_hkstar.com>
Date: Wed, 9 Feb 2000 08:23:32 +0800
Message-ID: <1e5q6tw.q5p7h61lw7c68N@[192.168.2.50]>


Hi,
I got completly fedup with trying to get this to work so I have a local procedure that converts the ' to a string then a procedure on the server that replaces the substitute back to the '

the following depends on what system you are using, ODBC, sqlnet8, visualbasic, foxpro

!*****************************************************************

*!
*! Procedure:fix_quotes
*!PASSED: a string
*! returned a string with all the ' changed to another string
*!must be performed otherwise passing it to oracle
*!messes up the passed perams for embeded '
*!*****************************************************************

procedure fix_quotes
&& this procedure finds and replaces the single quote char with a safe value

&& this is needed because when we call the oracle exec routine
&& we have to build a string , so any integral single or double quotes 
&& will mess up the string parsing.
&&
parameter scanstr
m.scanstr=upper(alltrim(m.scanstr))                     && convert to
uppercase & strip
if isnull(m.scanstr) or len(m.scanstr)=0 m.scanstr=" "
else
m.scanstr=STRTRAN(m.scanstr,"'",'"$SQUOTE"') endif
return m.scanstr

**
try not to substitute other values, since it depends on you local charset, and is not always cross platform.

kevin <kev_at_nexuscomp.co.uk> wrote:

> I have an oracle database
> i am inserting SQL statements into it.
> I have a line
> 
> insert into db1 values(12, 15, 'insert into db2 values(1,
> 2,'Fred Bloggs');');
> 
> any ascii value equivalent that will work
> for nested '
> 
> thankyou
> 
> 
> 
Received on Tue Feb 08 2000 - 18:23:32 CST

Original text of this message

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