Identify and replace a single quote in an In Parameter

Can anyone tell me the syntax for finding and replacing a single quote in a user entered string? Thanks.

Cav,
I tried this:
insert into emp values (9999,''''||'Must', 'ddd',7902, sysdate, 2000, null, 10) ;
select * from emp;
     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-12-1980        800                    20
      7499 ALLEN      SALESMAN        7698 20-02-1981       1600        300         30
      7521 WARD       SALESMAN        7698 22-02-1981       1250        500         30
      7566 JONES      MANAGER         7839 02-04-1981       2975                    20
      7654 MARTIN     SALESMAN        7698 28-09-1981       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-05-1981       2850                    30
      7782 CLARK      MANAGER         7839 09-06-1981       2450                    10
      7788 SCOTT      ANALYST         7566 19-04-1987       3000                    20
      7839 KING       PRESIDENT            17-11-1981       5000                    10
      7844 TURNER     SALESMAN        7698 08-09-1981       1500          0         30
      7876 ADAMS      CLERK           7788 23-05-1987       1100                    20
      7900 JAMES      CLERK           7698 03-12-1981        950                    30
      7902 FORD       ANALYST         7566 03-12-1981       3000                    20
      7934 MILLER     CLERK           7782 23-01-1982       1300                    10
      9999 'Must      ddd             7902 29-08-2005       2000                    10
select * from emp where ename = ''''||'Must';
     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
      9999 'Must      ddd             7902 29-08-2005       2000                    10Hope this helps
Ghulam

Similar Messages

  • Dynamic SQL and Data with Single Quotes in it.

    Hi There,
    I have a problem in that I am using dynamic SQL and it happens that one of the columns does contain single quotes (') in it as part of the data. This causes the resultant dynamic SQL to get confused as the single quote that is part of the data is taken to mean end of sting, when in fact its part of the data. This leaves out a dangling single quote that was meant to enclose the string. Here is my dynamic SQL and the result of the parsed SQL that I have captured:
    ****Dynamic SQL*****
    l_sql:='select NOTE_TEMPLATE_ID '||
    'FROM TMP_NOTE_TEMPLATE_VALUES '||
    'where TRIM(LEGACY_NOTE_CODE)='''||trim(fp_note_code)||''' '||
    'and TRIM(DISPLAY_VALUE)='''||trim(fp_note_text)||''' ';
    execute immediate l_sql INTO l_note_template_id;
    Because the column DISPLAY_VALUE contains data with single quotes, the resultant SQL is:
    ******PARSED SQL************
    select NOTE_TEMPLATE_ID
    FROM TMP_NOTE_TEMPLATE_VALUES
    where TRIM(LEGACY_NOTE_CODE)='INQ' and TRIM(DISPLAY_VALUE)='Cont'd'
    And the problem lies with the single quote between teh characters t and d in the data field for DISPLAY_ITEM. How can I handle this?
    Many thanks,

    I have been reliably informed that if one doesn't enclose char/varchar2 data items in quotes, the right indices may not be usedI am into oracle for past 4 years and for the first time i am hearing this.
    Your reliable source is just wrong. Bind variables are variables that store your value and which are used in SQL. They are the proper way to use values in your SQL. By default all variables in PL/SQL is bind variable.
    When you can do some thing in just straight SQL just do it. Dynamic SQL does not make any sense to me here.
    Thanks,
    Karthick.

  • Identifying and Replacing Tagged Text

    I have a TextFrame full of text. Different portions of the text are marked with different Tags.
    I want to identify the various runs of text by the Tag which marked them, and replace the content of that Tagged run of text according to its Tag using my business logic.
    For example, for the tags
    Tag1
    Tag2
    Tag3
    And the following Tagged text (I am including the square brackets which InDesign adds around Tagged text runs)
    [Vini][Vidi][Vici]
    I would like to be able to identify that
    "Vini" is marked by Tag1 (and should be replaced by "Ars")
    "Vidi" is marked by Tag2 (and should be replaced by "Gratia")
    "Vici" is marked by Tag3 (and should be replaced by "Artis")
    And then perform the replacement, giving:
    [Ars][Gratia][Artis]
    How would I go about this?

    Hi,
    look at the xmlelements ... that's the key to succes...
    What i would try to do is ...
    1. Loop over every PageItem
    2. Retreive the associated XML element
    3. Do a recursive search within all sub xmlelements
    4. check the name of every XML element
    5. If it's the correct XML element, change the content property to the new value
    for (var b = 0; b < myDoc.allPageItems.length; b++){
           var myXMLelement = myDoc.allPageItems[b].associatedXMLElement;
          ProcessXMLelement(myXMLelement);                           
    function ProcessXMLelement(elm){
           // Get the name of the Tag
          myTagName = elm.markupTag.name.toString();
         if (myTagName == "myTag"){
                   elm.contents = "New Text";
           // Process all sub elements
           for (var i = 0; i < elm.xmlElements.length; i++){
                ProcessXMLelement(elm.xmlElements[i]); 
    Hopefully this helps
    John

  • Find and replace a single global variable

    Hello,
    I have a GUI which needs to be replicated 10 times. the variables in the global file also needs to be replicated ten times. ex: if GUI1 is using global variables GUI1_TestMode, GUI1_Result etc,  GUI2 should use GUI2_TestMode, GUI2_Result and GUI3 should use GUI31_TestMode, GUI3_Result etc.  So, once I have saved GUI1 as GUI2, I need a way to select all GUI1_TestMode in GUI2 and replace it with with GUI2_TestMode.
    I tried find and replace in the edit menu, but it finds all the global variables together. 
    there are about 40 such global variables associated with each GUI and I dont think it will be sane to sit down, rename all of them in the global file, click on each variable and change them.  I really hope I dont have to do that.
    I am using Labview 8.6
    Thanks.

    Hi pcs,
    instead of using 40 globals per GUI with upto 10 different GUIs you really should redesign your program.
    I would suggest a FGV/AE handling those global data for all of those GUIs…
    The quick & dirty way would be to use LabVIEW's VI linking scheme:
    - Create your global VI with all needed variables. Create your "GUI" and connect it with that global VI.
    - Now you copy your GUI to create a new one, this will still be linked to your "global VI".
    - Then copy the global VI to create a new instance with a different name ("global2.vi") and ZIP (and remove) the original one.
    - When you now open the global2.vi it will search for your orginal "global.vi". Then you simply direct it to use "global2.vi" instead…
    - Repeat those steps for all other GUI-VIs…
    As said before: QUICK & DIRTY!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Passing single quotes in a lexical parameter from forms11g to reports 11g

    Hi,
    We've upgraded our forms and reports from 10.1.2.3 to 11.1.2.1 and this has broken a number of reports where we pass a string of single quoted variables to reports as a lexical parameter.
    v_string := ''''||:block.item1||''''||','||''''||:block.item2||''''
    select *
    from emp
    where emp_id in (&p_string)
    where v_string is simply passed as a text parameter to the report.
    I'm not clear why this should break now (its worked since 6i) and whether anyone is aware of it and/or a solution.
    Any help much appreciated as always
    Thank you

    Hi,
    Thanks for the suggestion I will try and give it a go.
    Do you mean for example in the form:
    v_string := $$dq||:block.item1||$$dq||','||$$dq||:block.item2||$$dq
    And in the report
    Begin
    replace(p_where_string,'$q','''');
    end;
    I would say that this even if this works it will prove painful to be updating every form AND report where this is used as we have a lot! I do really appreciate anyone taking the time to reply though!
    It would appear that there are several bugs recorded against this type of problem when moving to reports 11...
    Bug 11840698 - SIMPLE QUOTE REMOVED WHEN USING RUN_REPORT_OBJECT WITH PARAMLIST
    Status 11 - Code/Hardware Bug (Response/Resolution
    I will continue to update with responses from my SR.
    Thanks

  • Is it possible to identify and migrate a single app from iMac to MacBookPro instead of all the applications?

    In the migration of apps from my iMac to MacBookPro, one app did not migrate. Is there a way to redo the migration process but identify a single app and not the entire applications folder?

    Consider Target Disk Mode:
    http://support.apple.com/kb/ht1661
    Ciao.

  • 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, "'", "''");

  • Bridge Collection file / folder name single quote bug fix?

    Just starting using Bridge CS5 on WIndows 7.  Fresh install of OS and CS5.  Latest patches applied (4.0.5.11).
    After laboriously selecting 60+ files and creating a colelction, the collection showed zero items.
    I recreated the collection multiple times but same result.  This was supremely frustrating and a huge time waster for me (and I'm sure for others).
    Completely repeatable.
    Tracked this down to one of my folders having a single quote in its name.  This problem was documented back in 2010:
    http://forums.adobe.com/message/2936294
    I edited the collection file in notepad and replaced the single quote with %27.  Worked fine.
    But manually editting the collection file everytime I make a change to the collection or renaming my folder hierachry are not viable workarounds.
    Does anybody know if a fix was ever released for this?  What is Adobe's response to this? 
    It apparently is a regression (i.e. it was fixed in a pevious verision and now is back).
    This is a programming 101 bug (i.e. escaping special characters in file names). 
    This type of programing error is a real showstopper and really inexcuable, especially for how long it has been out there.
    Jeff

    Thanks for posting this problem on the photoshop feedback page.
    It's clear many of us have tripped on this issue and that it is time Adobe fixed this problem.
    To hedge our collective bets, I also filed a "bug report" using this web page:
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    It interesting to note that I did not find a bug report form for Bridge - the site just offers a redirect to the general feedback form on Photoshop.  But there was a bug report form for Premier Pro (a program they obviously care more about).  So I filed this issue as an official bug against Premier Pro thinking it may get greater visiability.  What follows is what I submitted.  If I hear back from the development team I'll let this thread know.
    Jeff
    ******BUG******
    File names / folders with single quotes (e.g., Jeff's Photos) are not properly escaped in the collection xml file created by Bridge which is used to manage assets in Photoshop, Premier Pro, etc. The single quote, which is a valid filename symbol in Windows, should be converted to %27 in the xml file but is left "as is" which prematurely terminates filename / folder strings.  The net effect varies based on the operation being performed, but it is typically a silent error (i.e. the user is given no warning anything is wrong) and can result in catastrophic loss of critical assets.
    It is simple to repro: just create a folder with a single quote in the name, populate it with content files, and create a collection.  The next time you use it, the collection shows up as 0 entries.
    The bug (which appears to be a regression) results in many users losing critical asset files and wasting huge amounts of time debugging this issue which was reported almost a year ago.  The forums have many threads on this problem - see my recent entry for an example:
    http://forums.adobe.com/message/4112499#4112499
    The bug is a trap that directly erodes customer confidence and satisfaction with Adobe's whole product line.  Bridge is billed as hub that is supposed to tie all products together - but it cannot be trusted.  Critical assets and time are lost.  This is trivial bug to fix and many customers are outraged that Adobe has done nothing to fix it or warn users about it - especially since this is in your professional line of products that cost over a thousand dollars.  Please escalate this fix immediately. 
    As a courtesy, please let me know this bug report was escalated and an ETA when a fix may become available.
    Thank you

  • 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 single quote with double quote

    hai all,
    i have a problem,
    i am trying insert a string containing single quote into ms-access database.
    it is giving error.
    how can i avoid this .if i replace a single quote in the text with double quote it will defenitely
    insert into database.
    in java.lang.String
    replace () will not work to replace quote with double quote.
    any otherway to solve this problem.
    please mail me to [email protected]
    thank you
    sambareddy
    inida

    java.lang.String.replace () will not work to replace quote with double quote.Really?
    String x = ...
    x.replace( "'", "\"" );

  • How to copy item value that contain a single quote(')?

    Hi,
    I have one "Copy" button in a APEX form. When user clicks it, it simply copy the item's values from the form to a new form by using APEX provided function behind the button- "Set these item values with these values". It is simple and works fine in normal cases. However, see, we have a text field called "Product Details", user types in for example "Oracle's new vision". When I click COPY button, APEX try to copy the text in "Product Details" field from this form to a new form but it returns error because of that single quote. Is there any way I can do something to replace that single quote with two single quote like we usually do in PL/SQL in the place "Set these item values with these values" of APEX button? I tried REPLACE(#P66_PRODUCT_DETAILS#., '''', '''''') but not work. I saw someone in the forum meantioned that to use something like "/#P66_PRODUCT_DETAILS#/" to get around. Any one with success?

    Thanks. I think it should work this way. However, our form has about 20 ~30 text fields, I have to create 20~30 hiddle fields to handle the problem because I never know which field could contain a single quote. Ideally, a new version of APEX should have the functionality to deal with the problem when using "set values with those values" method. At least, it should provide some kind of interaction for user to get away from single quote or comma or column etc.
    What I did is to get out of APEX native function and to create a new records in background by PL/SQL using record id that passed in from APEX form. It works perfectly. Although, user can only edit the record after it is created, not as user friendly as "Copy first-look at it-edit it-then create it" I originally planed.
    Thanks for your help,

  • Trouble with inserting a string containing a single quote

    Using php with Oracle
    If I do the following two lines before sending my $Query string through the parse function
    $name = "Dominick's";
    $Query = "INSERT INTO customers (name) values ('$name')";
    it gives me the following error:
    Warning: Ora_Parse failed (ORA-00917: missing comma -- while processing OCI function OPARSE)
    If I try and force the single quote to be surrounded by double quotes and therefore not be confused:
    $name = "Dominick's";
    Query = "INSERT INTO customers (name) values (\"$name\")";
    Trying that yields the following error:
    Warning: Ora_Parse failed (ORA-01741: illegal zero-length identifier -- while processing OCI function OPARSE)
    Help
    Jeff

    If it is possible (and here it is) you should use str_replace instead of ereg_replaceThanks for the reminder about str_replace().
    $Query = "INSERT INTO customers (name) values ('".addSlashes($name)."')";This gives an invalid Oracle SQL statement, which will generally fail with
      ORA-01756: quoted string not properly terminatedFor Oracle, single quotes must be doubled, not escaped with backslash.
    Of the solutions to insert the data, I'd prefer using bind variables
    since no escaping or quote doubling is needed.
    -- CJ

  • XML invalid character -  a single quote problem

    Hi, I am reading in an xml file, then write the file to output. The problem is that the input file has a strange single quote character [ *�*  ] - lets call it single quoate A, which is different from [  *'*  ] , that is the key next to the [ ; ] key on an English keyboard - lets call it single quate B. And in fact there isnt a key to input single quote A, I guess the appearance of single quote A is due to encoding.
    If I open the input xml file in browser, it works ok and displays the single quote A.
    Once I read in the xml file into memory, by debugging I can still see that single quote A is corrected encoded;
    However once I rewrite the same content to output, the single quote A character is changed, and if i open the file in browser, it says 'invalid character' because single quote A were changed when written to output and cannot be rendered.
    Both input and output xml are using UTF-8 encoding. How can I solve this problem please?
    The xml file looks:
    <?xml version="1.0" encoding="UTF-8" ?>
    <content>....1980�s (Peacock and Williams, 1986; Keay, 1984)</content> My code for reading
    String _xquery ="//content/text()";
    Document _xmlDoc= DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("myxml.xml");
    XPath _xpath = XPathFactory.newInstance().newXPath();
    NodeList nodes = (NodeList) _xpath.compile(query).evaluate(_xmlDoc, XPathConstants.NODESET);
    List<String> res = new ArrayList<String>(nodes.getLength());
    for (int i = 0; i < nodes.getLength(); i++) {
        res.add(nodes.item(i).getNodeValue());
    String valueToOuput=res.toString() //this is the value to be output to xml, it shoud look like "[....1980�s (Peacock and Williams, 1986; Keay, 1984)]"my code for writing xml
    Element root=new Element("root");;
    Element content= new Element("output-content")
    content.setText(valueToOutput);
    root.addContent(content);
    PrintWriter writer = new PrintWriter(new FileWriter(f));
    new XMLOutputter().output(domDocument, writer);
    writer.close();

    Hi, sorry I have fixed the problem... instead of using PrintWriter, I used Fileoutputstream, and it solved the problem. Thanks!

  • Having a single quote in command line

    I have a simple script that changes the permissions on directories. Just a series of chmods. The script is created by a FileMaker database (cos that maintains the list of folders i need to create for projects) and some of the pathnames include single quotes.
    The ' is of course a no-no on command, so is there a way to escape it? \' does not seem to work.

    If this is an AppleScript you need to double-escape the quote character to get it to work in the shell. The same may be true for Filemaker scripts.
    do shell script "chmod 755 /path/to/filename\\'with\\ escaped\\ chars"
    The first one tells AppleScript to escape the next character, so the second \ gets passed to the shell. The shell then interprets the \ to escape the single quote, space, or whatever character comes next.
    Without the double-escaping, AppleScript sees the first \ and passes the single quote to the shell which gets confused.

  • Unable to pass parameters in Report Bulder due to single quotes

    Hello,
    I have a problem with parameters in Report Bulder.
    This is the query:
    where task.closed_at between (@Per)
    Then I need have to pass following value to @Per : DATEADD(month, -5, getdate()) and getdate()
    to get following:
    where task.closed_at between DATEADD(month, -5, getdate()) and getdate()
    But I suppose Report Builder put the values to quotes and WHERE looks like:
    where task.closed_at between 'DATEADD(month, -5, getdate()) and getdate()'
    and Builder returns syntax error.
    How can I solve this issue and avoid these single quotes surrounding the value?
    Thank you.

    Hi zotchy07,
    According to your description, you have a report created use Report Builder. You want to select data according to the search condition: task.closed_at within 5, 12 or 24 months.
    Please refer to the following steps to achieve your goal:
     1. In design surface, right-click Parameter and click Add Parameter.
     2. In Report Parameter Properties dialog box, type the name and prompt, set  Data Type to Integer.
     3. Click Available Values in left pane, check Specify Values.
     4. Click Add, set Label to 5, Value to -5.
     5. Repeat step4 above, set Label to 12, Value to -12, then Label to 24, Value to -24, then click OK.
     6. Right-click the dataset you used to retrieve data and open Dataset Properties dialog box.
     7. Click Filters in left pane, click Add.
     8. From Expression drop down list, select closed_at and set Operator to between.
     9. Click the first (fx) button and type the expression like below:
    =DateAdd("m", Parameters!param_name.Value,Today())
     10. Click the second (fx) button and type the expression like below, then click OK.
    =Today()
    In this way, when we preview the report, there are 3 selects in the parameter drop down list: 5, 12, 24. If we select 5 and click View Report, the data within 5 months will be displayed.
    The following screenshots are for your reference:
     If you have any questions, please feel free to let me know.
    Best Regards,
     Wendy Fu

Maybe you are looking for

  • Subquery Factoring Fail

    Someone please help me understand why I get the results I do with this simple query: WITH RUNDATES AS (      SELECT      RUN.RN_EXECUTION_DATE AS ACTUAL_DATE,      TC_PLAN_SCHEDULING_DATE AS PLANNED_DATE      FROM TESTCYCL      LEFT JOIN RUN ON RUN.R

  • Importing Database Package into OWB changes position of parameters .. Nasty

    Hi all, Anyone else having the same problem ? Any solutions ? Or is this a bug. When a package is imported from a DB schema, OWB kindly changes the order in which the parameters are listed. The effect is that any mapping using the procedure or functi

  • Large buzzing on my DV tape-how can I remove it?

    Unfortunately we had a problem when filming, and a quite large buzzing noise is heard in the background, and the voices (an interview is going on) are quiet. Are there ANY applications, or otherwise options in FCP or similar applications to reduce or

  • No external disk icon on desktop

    I can not see my WD My Book when it is connected directly to my MBP 15 10.5.1. I get no icon and it does not appear in finder. I do see it in disk utility. This just stopped working all of a sudden. How do I get the disk back??

  • COPA tables

    All In Account COPA I see two tables, One CE4XXXX and other is CE4XXXX_ACCT. What is the difference between these two tables. CE4XXXX_ACCT has much much more records as compared to the CE4XXXX table. If I was to use either of the two for reporting an