Replace single quote with two single quotes

Hi all,
I have a value = ABCD'S(>@!23. i want to replace the value as ABCD''S(>@!23.
Thanks in advance

What is your database version ? Q operator works from 10G onwards.
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 23 14:35:38 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn hr
Enter password:
Connected.
SQL>  CREATE TABLE test_Q_operator(str VARCHAR2(30));
Table created.
SQL> INSERT INTO test_Q_operator VALUES('ABCD''S(>@!23');
1 row created.
SQL> INSERT INTO test_Q_operator VALUES('Saubhik''s test row');
1 row created.
SQL> commit;
Commit complete.
SQL> SELECT str,REPLACE(str,Q'[']',Q'['']') col2
  2  FROM test_Q_operator;
STR
COL2
ABCD'S(>@!23
ABCD''S(>@!23
Saubhik's test row
Saubhik''s test row
SQL>Also check you SQL*PLUS client version.

Similar Messages

  • SQL Injection, replace single quote with two single quotes?

    Is replacing a single quote with two single quotes adequate
    for eliminating
    SQL injection attacks? This article (
    http://www.devguru.com/features/kb/kb100206.asp
    ) offers that advice, and it
    enabled me to allow users to search name fields in the
    database that contain
    single quotes.
    I was advised to use "Paramaterized SQL" in an earlier post,
    but I can't
    understand the concept behind that method, and whether it
    applies to
    queries, writes, or both.

    Then you can use both stored procedures and prepared
    statements.
    Both provide better protection than simply replacing
    apostrophes.
    Prepared statements are simple:
    Set myCommand = Server.CreateObject("ADODB.Command")
    ...snip...
    myCommand.CommandText = "INSERT INTO Users([Name], [Email])
    VALUES (?, ?)"
    ...snip...
    myCommand.Parameters.Append
    myCommand.CreateParameter("@Name",200,1,50,Name)
    myCommand.Parameters.Append
    myCommand.CreateParameter("@Email",200,1,50,Email)
    myCommand.Execute ,,128 'the ,,128 sets execution flags that
    tell ADO not to
    look for rows to be returned. This saves the expense of
    creating a
    recordset object you don't need.
    Stored procedures are executed in a similar manner. DW can
    help you with a
    stored procedure through the "Command (Stored Procedure)"
    server behavior.
    You can see a full example of a prepared statement by looking
    at DW's
    recordset code after you've created a recordset using version
    8.02.
    "Mike Z" <[email protected]> wrote in message
    news:eo5idq$3qr$[email protected]..
    >I should have repeated this, I am using VBScript in ASP,
    with an Access DB.
    >

  • How to replace one double quotes with two double quotes in XSLT

    How can I replace one double quote to a two double quote in a string in XSLT
    I am passing the parameter string to XSLT template contains the value as
    <xsl:variable name="Description">Hi! "How are you</xsl:variable>
    <xsl:variable name="VQuotes">""</xsl:variable>
    I nead the output as
    Hi! ""How are you.
    Tried with Translate function, but it did not work out
    <xsl:element name="DESCRIPTION_SHORT">
              <xsl:value-of select="translate($Description,'&quot;', VQuotes)" />
            </xsl:element>But it is giving the same result as Hi! "How are you
    When I tried with
    <xsl:element name="DESCRIPTION_SHORT">
              <xsl:value-of select="translate($Description,'&quot;', 'BB')" />
            </xsl:element>
    It gave the result as
    Hi! BHow are you.
    It is replacing only one character with one. how to make it for two characters.
    Am I doing anything wrong in syntax?
    Please help.
    Regards, Vignesh S

    Hi Vignesh,
    Try this.
    Its a two step process:
    Step1: Add the following template would be "called" to do the replacement as your want:
    <xsl:template name="string-replace-all">
    <xsl:param name="text" />
    <xsl:param name="replace" />
    <xsl:param name="by" />
    <xsl:choose>
    <xsl:when test="contains($text, $replace)">
    <xsl:value-of select="substring-before($text,$replace)" />
    <xsl:value-of select="$by" />
    <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text"
    select="substring-after($text,$replace)" />
    <xsl:with-param name="replace" select="$replace" />
    <xsl:with-param name="by" select="$by" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Step2: Call the above templeate in the place where you want to call, like this:
    <!--Define the variables-->
    <xsl:variable name="Description">Hi! "How are you</xsl:variable>
    <xsl:variable name="sQuotes">"</xsl:variable>
    <xsl:variable name="VQuotes">""</xsl:variable>
    <!--Following call the template which you have defined in step1-->
    <xsl:element name="DESCRIPTION_SHORT">
    <xsl:variable name="myVar">
    <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text" select="$Description" />
    <xsl:with-param name="replace" select="$sQuotes" />
    <xsl:with-param name="by" select="$VQuotes" />
    </xsl:call-template>
    </xsl:variable>
    <xsl:value-of select="$myVar" />
    </xsl:element>
    I have tested this and works. And outputs as the following with two-double quote as you want.
    <DESCRIPTION_SHORT>Hi!
    ""How are you</DESCRIPTION_SHORT>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How do I replace one ' (Single Quote) with '' (Two single Quote)

    Hi,
    I have been surfing around the forum, coudn't find the similiar case.
    I have been trying but fail. Below is my code:
    activity = request.getParameter("activity");
    activity = activity.replace("\'", "\'\'");
    Error Occur:
    Incompatible type for method. Can't convert java.lang.String to char. activity = activity.replace("\'", "\'");
    I'm trying to use replaceAll(), but seem like the method is not existed, we are using Version Java 1.3
    Pls advise.
    Regards
    Ying

    For JDK 1.3 or ealier, use this:
      public static String replaceSubstrings(String str, String sub, String rep){
        int s, p, q;
        int slen = sub.length();
        StringBuffer sb = new StringBuffer();
        s = 0;
        p = str.indexOf(sub);
        q = p + slen;
        while (p != -1){
          sb.append(str.substring(s, p));
          sb.append(rep);
          s = q;
          p = str.indexOf(sub, s);
          if (p != -1){
            q = p + slen;
        sb.append(str.substring(s));
        return sb.toString();
    activity = replaceSubstrings(activity, "'", "''");

  • Is it possible to use a single iPhone with two contact numbers via dual sim or an app?

    Is it possible to use a single iPhone with two contact numbers via dual sim or an app?
    This would be a useful feature for personal and company numbers but using one mobile, rather than carrying two devices or diverting calls.

    Then go ahead and try it.  You'll find it's probably a load of crap.
    You want 2 numbers, then use Google Voice or TalkaTone
    Those are US based only Apps or numbers so no good. I won't be wasting money by just trying something either, especially because using a dual sim would mean purchasing another sim card on either pay as you go or monthly contact.

  • How to replace one char with two chars in email address policy?

    I very much like to replace the 'ß' char in the surname with 'sz'. However, applying filter '%rßsz%[email protected]' on 'Preußig' leaves me with '[email protected]'.
    So, how do I replace one char with two chars in email address policy?

    As far as I know, your only solution is to manually create such addresses instead of using e-mail address policy.
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • How to replace double quotes with a single quote in a string ?

    Hi All:
    Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
    My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
    Thanks,
    Dima.

    Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
    SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
    REPLACE(
    STN. 'A'{code}
    Nicoals.                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Replacing multiple spaces with a single space

    Hi friends,
    I have a string. It can have zero/one/multiple spaces. I want to make the multiple spaces to single space.
    Here are the cases:
    1. ' a b c d efg h' should be changed to 'a b c d e f g h'
    2. ' a b c d e f g h ' should be changed to 'a b c d e f g h'
    3. 'a b c d e f g h' should not be changed
    4. 'abcdefgh' should not be changed
    Both REPLACE and TRANSLATE do not help. I don't want to go for LOOP logic. Please help me to get it in SQL query.
    Thanks in advance!

    Hi,
    964559 wrote:
    Hi friends,
    I have a string. It can have zero/one/multiple spaces. I want to make the multiple spaces to single space.
    Here are the cases:
    1. ' a b c d efg h' should be changed to 'a b c d e f g h'One solution is to post your string on this site, and then copy it back again. (See below for a more serious solution .)
    This site is doing exactly what you want the function to do: it replaces multiple consecutive spaces with a single space. As a result, it's hard to see what you mean.
    To preserve spacing on this site, type these 6 characters
    \(small letters only, inside curly brackets) before and after each section where you want spacing preserved.
    2. ' a b c d e f g h ' should be changed to 'a b c d e f g h'
    3. 'a b c d e f g h' should not be changed
    4. 'abcdefgh' should not be changed
    Both REPLACE and TRANSLATE do not help. I don't want to go for LOOP logic. Please help me to get it in SQL query.
    Thanks in advance!Regular expressions make this easy:SELECT TRIM ( REGEXP_REPLACE ( str
    , ' +'
    ) AS compressed_str
    FROM table_x;
    You can use nested REPLACE calls to get the same results, but it's messy.
    Edited by: Frank Kulash on Feb 5, 2013 10:18 AM
    Added TRIM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to handle single quote between two single quotes in ABAP?

    Dear SAP Gurus
    I have a question regarding handling a string data.
    Say I have a string  ABCD'\&%$!!ABC'AAA123.   Please notice that there are single quotes in my string.
    I am writing a parser code in ABAP and getting into problem with if statement to check if the character read is a single quote.
    When I type the following with a singleQuote between 2 singleQuoes as below, it gives error.
    If CHAR = '''.
    ENDIF.
    How do I handle that? I searched for escape sequence and couldn't get any useful info.
    Any feedback will be highly appreciated.
    Thanks
    Ram

    Or just use string literals
    if char = `'`.   "note that ` is the "backquotation" mark not a regular quotation mark '
    Regards
    Marcin

  • Single crypto with two peer

    dear All,
    issue : cisco 2811 , IP sec tunnel establishement with single crypto defined but two set peer
    ip address.
    i want to know :
    In a single crypto map if i define two peer IP address (set Peer ) then did the VPN will come
    up from both the Peer IP OR it will try from the first one and then switch back on the second
    set peer. if later is the case then what are the reasons for causing switch back. .
    Rgds,mac.

    If the first one is no longer reachable, it will fall-back to the second peer.
    Regards
    Farrukh

  • Inspection Type 10-Single Mat with two Diff Insp Typ with separate Char.

    Hi,
    I am using Inps with Mat Specs.
    I have single Finished Product having Insp type 4 & 10 attached.
    There are 8 char attached to Material out of first 4 should be visible for lot generated for insp type 4 and last 4 should be visible in Result recording screen for newly generated lot after doing Delivery i.e. 10 Insp type.
    Is there any setting for the same.
    Regards
    Nilesh

    There is no such provision available.You are using material specs then you have to consider 04 & 10 seperatly as there usage is different.
    or simply create task list with differnt usage like 1 & 6 with specific char.this will work fine.

  • Excel 2010; Two file opened in a single instance with two different windows... Is it possible?

    Hello
    I'm using Excel 2010
    I need to open a new Excel file to be display on a 2' monitor.  The new file need to be under the same instance has my main Excel file to prevent problem with a special dll collection that I'm using.
    I need to have both file in a separate window
    Is it possible?
    Excuse my English
    Martin

    Hi Martin,
    Open two excel file in one excel instance, display them to different windows.
    Please try the methods listed in the thread below:
    http://social.technet.microsoft.com/Forums/en-US/6ba32569-19a0-4b45-806f-9a42258bdb5f/how-to-open-two-excel-files-in-multiple-monitors-in-windows-7?forum=excel
    Best Regards,
    Wind

  • Issues with sharing a single OID with two Application servers (9.0.4)

    We have two installations of 9.0.4 Application Servers and both share the same OID. We use Oracle Portal for deploying our jsp applications.
    All users in the OID are sync'ed from Microsoft Active Directory.
    Application Server 1 is for an application X
    Application Server 2 is for an application Y
    We create groups in the portal of Application Server 1 specifically for Application X. DEF_GROUP1 is default group for all applications in application X
    DEF_GROUP1 has a default page - Page 1. DEF_GROUP 1 does not exist in Application server 2
    We create groups in the portal of Application Server 2 specifically for Application Y. DEF_GROUP2 is default group for all applications in application Y
    DEF_GROUP2 has a default page - Page 2
    DEF_GROUP2 does not exist in application server 1
    We have users who access both application X and applicaiton Y
    For a user "JOHN" we assign DEF_GROUP1 in the user profile on the portal in Application Server 1
    When we go to the user profile of "JOHN" on application server 2, we find that DEF_GROUP1 is a default group in the user profile of user "JOHN"
    If we change it DEF_GROUP2, then the default group on the portal of application server 1 automatically changes to DEF_GROUP2.
    Why is this so ? We would like to have a different default group for the same user in the two portal repositories. ?
    Can any one provide some insight into this issue ?

    Basically I started to develop this system inside Oracle AS and then when it came time to passing a request to a new page, it crapped out on me on the App. Server. So instead of trying to fix the problem there and then I continued to develop outside Portal and inside Jdeveloper. After a week or two once all my stuff worked perfectly I try and take it back into Portal but only the first JSP of all my Portlets would show up, because as soon as I would submit a form and the action directed me to a new page and Portal would be lost/confused. Obviously I shouldn't have done it that way but none the less...
    So now I'm reading through the documentation you pointed me towards and it seems I have to qualify my parameters and then "attach" them to the url which the form will pass to the actioned page. I'm importing numerous classes (...urlUtils, etc) in order to qualify the parameters and then build this url without affecting any parameters currently present that my portlet does not own.
    What I'm rambling towards here is all this separation of logic and presentation and the whole nine, implies different people can develop different parts of a 'system' mostly independant of one another...so in my situation I shouldn't in huge trouble yet, since underlying everything is a working system. My issue is with oracle and the App Server. If I take my code which works great outside of the App. Server and I fully qualify parameters and make sure my form actions are constructed using the UrlUtils in order to fully qualify them as well, and then I make sure page parameters are mapped to the proper portlet parameter values....should my system work on the App Server (assuming everything is done properly)....or am I still missing something.

  • Best way to share AddressBook on single mac with two users?

    Hey everyone. I'm still pretty new to the Mac world here and I have a quick question. I just got my first iMac this past weekend. I've set it up so that my wife and I both have user accounts on the machine. I was wondering if there is a way or what is the best way to get it so that we can both share the same AddressBook? Is there a sync utility out there for AddressBook like there is for iCal? I would like it so that both us can can read and write to the AddressBook. Thanks in advance!

    Did you have a look at Address Book Server or Address Book X LDAP. Address Book Server let's you replicate your entire Address Book over several networks macs. Each contributing client is able to access all shared contacts, as well as make changes. Address Book Server support synchronisation in both directions.
    Address Book X LDAP on the other hand allows the updating of a centrally shared LDAP directory. It only supports writing to the LDAP directory, but has support for several attribute mappings (inetOrgPerson, abxldapPerson etc). Reading from LDAP is limited to the LDAP integration of the standard Address Book.
    Could you explain what you mean by "categories". Did you mean groups. Sharing of individual groups is supported by both tools.
    Regards
    Alex

  • Is there any way to DISABLE/RE-ENABLE a SINGLE cookie with a SINGLE click?

    I'm unable to figure out a SINGLE-CLICK method for blocking/unblocking just ONE cookie.... for example, the data-sucking obscenely intrusive google.com cookie. (something I could put on the desktop and just click once when needed) I do flush History at the end of every session and I have the Toggle Favorites buttons for disabling Java&Flash but that's not practical when I've a dozen or more windows/tabs open.
    The frustrating click-heavy method Cor-el would likely suggest of drilling down thru FF's Tools> Options> Exceptions> path and then scrolling down to unblock and then re-block google.com quickly becomes tiresome during long surfing/researching sessions, and it wouldn't address google's First Party HTTPS cookie. I'm not even sure where google's First Party cookie is stored.
    FWIW, I rely on useful add-ons/extensions/plug-ins and FREE software - CCLeaner, SpywareBlaster, NoScript, Ghostery, AdBlock Edge and BetterPrivacy to tailor my "personal browsing experience" on various web sites that abuse eyeballs. I typically leave all 3rd-Party cookies blocked but that google.com and their HTTPS version are inherently the most persistent/egregious, especially as the HTTPS version exploits the First Party cookie rule. Maybe I'm overlooking an obvious settings workaround but I suspect what's really needed is a dedicated PurgeBlockKillGoogle utility or a command file that modifies a Registry entry or a FF session setting with one click.
    If anyone can point me to a plug-in, add-on or browser independent DOS command or utility that accomplishes this, I'll personally petition Santa to bring you 2 new front teeth for Xmas! Even a one click method of opening FF's EXCEPTIONS would eliminate about 50 clicks a day. Seriously, help would be greatly appreciated.

    Been years since I've seen mention of Cookie Monster. For some reason I thought it was paid software, didn't know there was a plug in, happy to give it a try and see if it'll do the trick. Thanks!

Maybe you are looking for