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: replace ' with '' ???

RE: replace ' with '' ???

From: Eberhard, Jeff <Jeff.Eberhard_at_Rolls-RoyceGS.com>
Date: Fri, 19 Sep 2003 09:39:40 -0800
Message-ID: <F001.005D0846.20030919093940@fatcity.com>


Janet,

Sorry, I'm just going through the list. I've run into the same problem. Have you got any answers? I got it resolved by using the following code that I found but I don't remember where/who I found it from. Something like this:

     String FChar =
request.getParameter("p_location_name").toUpperCase().trim();

             StringBuffer lsNewStr = new StringBuffer();
             int liFound = 0;
             int liLastPointer=0;
             do {
               liFound = FChar.indexOf('\'', liLastPointer);
               if ( liFound < 0 )
                  lsNewStr.append(FChar.substring(liLastPointer,
FChar.length()));
               else {
                  if (liFound > liLastPointer)
 
lsNewStr.append(FChar.substring(liLastPointer,liFound));
                  lsNewStr.append('\'');
                  lsNewStr.append('\'');
                  liLastPointer = liFound + 1;
               }
             }while (liFound > -1);
         FChar = lsNewStr.toString();


Perhap you have received better answers than this that you could share with me.

Thanks,
Jeff Eberhard
Database Administrator
Rolls-Royce Gear Systems

-----Original Message-----
Sent: Tuesday, September 16, 2003 1:45 PM To: Multiple recipients of list ORACLE-L

Hi,

I apologize it might be a wrong place to post the question, but since it's the only list I know ...

You know when you insert a'b into db, you got to change it to a''b, our value is from jsp, so I have this
request.getParameter("p_location_name").toUpperCase().trim(), in case there is ' in it, I need to replace it with ''. How to do this in jsp, I tried
string.replace('\'','\'\''), replace("'","''"), replace("\'","\'\'"), all sorts stuff and doesn't work. We are using jdk 1.3.1. Any suggestion??

Thank you!

Janet



Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Janet Linsy
  INET: janetlinsy_at_yahoo.com
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Eberhard, Jeff
  INET: Jeff.Eberhard_at_Rolls-RoyceGS.com
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Sep 19 2003 - 12:39:40 CDT

Original text of this message

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