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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: quote in string

Re: quote in string

From: <elkinsl_at_flash.net>
Date: Wed, 27 Sep 2000 14:26:35 -0500 (CDT)
Message-Id: <10632.118055@fatcity.com>


Lisa,

Try coding the INSTR as:

instr(name,'''') > 0

The first quote denotes the start of the string, the second and third quotes gives one quote, and the fourth closes the string. Try the following 2 queries to get a feel for it:

select 'O''Connor' From Dual; 2 quotes outputting one quote select '''' from dual; Now outputting just a single quote

If seeing so many tickies starts to get confusing, you can use the CHR function directly in the INSTR:

instr(name,chr(39)) > 0

Or some people like to assign CHR(39) (or '''') to a variable and refer to the variable throughout their code. Those are just a few of the *many* ways to handle this. You may prefer other suggestions that are sure to appear.

Regards,

L. Elkins

On Wed Sep 27 14:36:39 2000, "Koivu, Lisa" <lkoivu_at_qode.com>,ORACLEL @fatcity.com wrote:

> Hi all -
>
> I'm putting my developer hat on again. I am writing a procedure that
parses
> through a string. However, the single quote ( ' ) is becoming a headache. I
> can't replace() it, I can't instr() and look for it. I am beginning to think
> the only way I can get around this when I trip onto it in my code (and get
> it out of my string) is to fall into an exception and check character by
> character and recreate the string in a variable, and handle the exception
> caused by the single quote when it occurs, ignoring the current character,
> and continuing.
>
> Has anyone got a better idea?
> Thanks in advance for any suggestions.
>
> Lisa Rutland Koivu
> Oracle Database Administrator
> Qode.com
> 4850 North State Road 7
> Suite G104
> Fort Lauderdale, FL 33319
>
> V: 954.484.3191, x174
> F: 954.484.2933
> C: 954.658.5849
> http://www.qode.com
>
> "The information contained herein does not express the opinion or position
> of Qode.com and cannot be attributed to or made binding upon Qode.com."
>
>
> Hi all -
>
> I'm putting my developer hat on again. I am writing a procedure that
parses
> through a string. However, the single quote ( ' ) is becoming a headache. I
> can't replace() it, I can't instr() and look for it. I am beginning to think
> the only way I can get around this when I trip onto it in my code (and get
> it out of my string) is to fall into an exception and check character by
> character and recreate the string in a variable, and handle the exception
> caused by the single quote when it occurs, ignoring the current character,
> and continuing.
>
> Has anyone got a better idea?
> Thanks in advance for any suggestions.
>
> Lisa Rutland Koivu
> Oracle Database Administrator
> Qode.com
> 4850 North State Road 7
> Suite G104
> Fort Lauderdale, FL 33319
>
> V: 954.484.3191, x174
> F: 954.484.2933
> C: 954.658.5849
> http://www.qode.com
>
> "The information contained herein does not express the opinion or position
> of Qode.com and cannot be attributed to or made binding upon Qode.com."
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
> charset=iso-8859-1">
> <META NAME="Generator" CONTENT="MS Exchange Server version
> 5.5.2650.12">
> <TITLE>quote in string</TITLE>
> </HEAD>
> <BODY>
>
> <P><FONT SIZE=2 FACE="Arial">Hi all - </FONT>
> </P>
>
> <P><FONT SIZE=2 FACE="Arial">I'm putting my developer hat on
> again.  I am writing a procedure that parses through a string.  However, the
> single quote ( ' ) is becoming a headache. I can't replace() it, I can't instr
() and look
> for it. I am beginning to think the only way I can get around this when I
trip onto it in
> my code (and get it out of my string) is to fall into an exception and check
character by
> character and recreate the string in a variable, and handle the exception
caused by the
> single quote when it occurs, ignoring the current character, and continuing.
> </FONT></P>
>
> <P><FONT SIZE=2 FACE="Arial">Has anyone got a better idea? 
> </FONT>
> <BR><FONT SIZE=2 FACE="Arial">Thanks in advance for any
> suggestions. </FONT>
> </P>
>
> <P><B><FONT SIZE=1 FACE="Arial">Lisa Rutland
> Koivu</FONT></B>
> <BR><FONT SIZE=1 FACE="Arial">Oracle Database
> Administrator</FONT>
> <BR><FONT SIZE=1 FACE="Arial">Qode.com</FONT>
> <BR><FONT SIZE=1 FACE="Arial">4850 North State Road 7</FONT>
> <BR><FONT SIZE=1 FACE="Arial">Suite G104</FONT>
> <BR><FONT SIZE=1 FACE="Arial">Fort Lauderdale, FL 
> 33319</FONT>
> </P>
>
> <P><FONT SIZE=1 FACE="Arial">V: 954.484.3191, x174</FONT>
> <BR><FONT SIZE=1 FACE="Arial">F: 954.484.2933 </FONT>
> <BR><FONT SIZE=1 FACE="Arial">C: 954.658.5849</FONT>
> <BR><FONT SIZE=1 FACE="Arial"><A
> HREF="http://www.qode.com"
> TARGET="_blank">http://www.qode.com</A></FONT>
> </P>
>
> <P><I><FONT COLOR="#000000" SIZE=1
> FACE="Arial">"The information contained herein does not express the
Received on Wed Sep 27 2000 - 14:26:35 CDT

Original text of this message

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