How to update row when data contains single quote  ?

Hi,
Please see this query:
update query_tab set  title='It's common knowledg' where
id='1121';I have this update query coming from .NET, but abviously this is error since single quote in the text (title column) given by user gives wrong meaning to sql parser. So, how to solve this problem ?
Edited by: bootstrap on Dec 25, 2010 9:53 AM

Hi,
To include a single-quote in a string literal, use two of them in a row:
update      query_tab
set       title     = 'It''s common knowledge'
where      id     = '1121';The method above works in any version of Oracle.
Starting in Oracle 10, you can also use Q-notation, like this:
update      query_tab
set       title     = Q'[It's common knowledge]'
where      id     = '1121';For details, look up "Text Literals" in the SQL Language manual:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements003.htm#sthref337

Similar Messages

  • How to find out when data was deleted from table in oracle and Who deleted that

    HI Experts,
    Help me for below query:
    how to find out when data was deleted from table in oracle and Who deleted that ?
    I did that to fidn out some data from dba_tab_modifications, but I m not sure that what timestamp shows, wether it shows for update,insert or delete time ?
    SQL> select TABLE_OWNER,TABLE_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP,DROP_SEGMENTS,TRUNCATED from dba_tab_modifications where TABLE_NAME='F9001';
    TABLE_OWNER                    TABLE_NAME                        INSERTS    UPDATES    DELETES     TIMESTAMP         DROP_SEGMENTS TRU
    PRODCTL                        F9001                                                     1683         46       2171            11-12-13 18:23:39             0                   NO
    Audit is enable in my enviroment?
    customer is facing the issue and data missing in the table and I told him that yes there is a delete at 11-12-13 18:23:39 in table after seeing the DELETS column and timestamp in dba_tab_modifications, but not sure I am right or not
    SQL> show parameter audit
    NAME                                 TYPE        VALUE
    audit_file_dest                      string      /oracle/admin/pbowe/adump
    audit_sys_operations                 boolean     TRUE
    audit_syslog_level                   string
    audit_trail                          string      DB, EXTENDED
    please help
    Thanks
    Sam

    LOGMiner --> Using LogMiner to Analyze Redo Log Files
    AUDIT --> Configuring and Administering Auditing

  • Problem of update rows in data object

    Hi everybody,
    I got the error message.
    Cannot update rows in data object /Samples/Monitor Express/BI_default_Project1_Process1.java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    Please advise!!!!

    Are you using alterts related to that data object?
    Do you have any open report that uses that data object?

  • JTable: HOW TO INSERT ROWS AND DATA?

    I have one JFrame on screen and inside of this i have a JTable, the question is how to insert rows and data into the JTable?

    [http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]
    In future, please post Swing questions to the [Swing Forum.|http://forums.sun.com/forum.jspa?forumID=57]
    In short, your TableModel is probably a DefaultTableModel . Study its API.

  • 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.

  • Copying a table with the right-click menu in schema browser fails to copy comments when string has single quote(s) (ascii chr(39))

    Hi,
    I'm running 32-bit version of SQL Developer v. 3.2.20.09 build 09.87, and I used the built in context menu (right-clicking from the schema browser) today to copy a table.  However, none of the comments copied.  When I dug into the PL/SQL that the menu-item is using, I realized that it fails because it doesn't handle single quotes within the comment string.
    For example, I have a table named WE_ENROLL_SNAPSHOT that I wanted to copy as WE_ENROLL_SNAPSHOT_V1 (within same schema name)
    1. I right-clicked on the object in the schema browser and selected Table > Copy...
    2. In the pop-up Copy window, I entered the new table name "WE_ENROLL_SNAPSHOT_V1" and ticked the box for "Include Data" option.  -- The PL/SQL that the menu-command is using is in the "SQL" tab of this window.  This is what I extracted later for testing the issue after the comments did not copy.
    Result: Table and data copied as-expected, but no column or table comments existed.
    I examined the PL/SQL block that the pop-up window issued, and saw this:
    declare
      l_sql varchar2(32767);
      c_tab_comment varchar2(32767);
      procedure run(p_sql varchar2) as
      begin
         execute immediate p_sql;
      end;
    begin
    run('create table "BI_ETL".WE_ENROLL_SNAPSHOT_V1 as select * from "BI_ETL"."WE_ENROLL_SNAPSHOT" where '||11||' = 11');
    select comments into c_tab_comment from sys.all_TAB_comments where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT' and comments is not null;
    run('comment on table BI_ETL.WE_ENROLL_SNAPSHOT_V1 is '||''''||c_tab_comment||'''');
    for tc in (select column_name from sys.all_tab_cols where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT')
        loop
       for c in (select comments from sys.all_col_comments where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT' and column_name=tc.column_name)
       loop
       run ('comment on column BI_ETL.WE_ENROLL_SNAPSHOT_V1.'||tc.column_name||' is '||''''||c.comments||'''');
    end loop;
    end loop;
    EXCEPTION
      WHEN OTHERS THEN NULL;
    end;
    The string of the table comment on WE_ENROLL_SNAPSHOT is this:
    WBIG table of frozen, point-in-time snapshots of Enrolled Students by Category/term/pidm. "Category" is historically, and commonly, our CENSUS snapshot; but, can also describe other frequencies, or categorizations, such as: End-of-Term (EOT), etc. Note: Prior to this table existing, Census-snapshots were stored in SATURN.SNAPREG_ALL. All FALL and SPRING term records prior-to-and-including Spring 2013 ('201230') have been migrated into this table -- EXCEPT a few select prior to Fall 2004 (200410) records where there are duplicates on term/pidm. NO Summer snapshots existed in SNAPREG_ALL, but were queried and stored retroactively (including terms prior to Spring 2013) for the purpose of future on-going year-over-year analysis and comparison.
    Note the single quotes in the comment: ... ('201230')
    So, in the above PL/SQL line 11 grabs this string into "c_tab_comment", but then line 12 fails because of the single quotes.  It doesn't know how to end the string because the single quotes in the string are not "escaped", and this messes up the concatenation on line 12.  (So, then no other column comments are created either because the block throws an error, and goes to line 22 for the exception and exits.)
    When I modify the above PL/SQL as my own anonymous block like this, it is successful:
    declare
      c_tab_comment VARCHAR2(32767);
    begin
    SELECT REPLACE(comments,chr(39),chr(39)||chr(39)) INTO c_tab_comment FROM sys.all_TAB_comments WHERE owner = 'BI_ETL'   AND table_name = 'WE_ENROLL_SNAPSHOT'  AND comments IS NOT NULL;
    EXECUTE IMMEDIATE 'comment on table BI_ETL.WE_ENROLL_SNAPSHOT_V1 is '''||c_tab_comment||'''';
    for tc in (select column_name from sys.all_tab_cols where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT')
        loop
       for c in (select REPLACE(comments,chr(39),chr(39)||chr(39)) comments from sys.all_col_comments where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT' and column_name=tc.column_name)
       loop
       EXECUTE IMMEDIATE 'comment on column BI_ETL.WE_ENROLL_SNAPSHOT_V1.'||tc.column_name||' is '||''''||c.comments||'''';
    end loop;
    end loop;
    EXCEPTION
      WHEN OTHERS THEN NULL;
    end;
    On lines 4 and 8 I wrapped the "comments" from sys.all_tab_comments and sys.all_col_comments with a replace command finding every chr(39) and replacing with chr(39)||chr(39). (On line 8 I also had to alias the wrapped column as "comments" so line 10 would succeed.)
    Is this an issue with SQL Developer? Is there any chance that the menu-items can handle single quotes in comment strings? ... And, of course this makes me wonder which other context menu commands in the tool might have a similar issue.
    Thoughts?
    thanks//jacob

    PaigeT wrote:
    I know about quick drop, but it isn't helpful here. I want to be able to right click on a string or array wire, navigate to the string or array palette, and select the corresponding "Empty?" comparator. In this case, since I do actually know where those functions live, and I'm already using my mouse to right click on the wire, typing ctrl-space to open quick drop and then typing in the function name is actually more work than navigating to it in the palette. It would just be nice to have it on hand in the location I naturally go to look for it the first time. 
    I don't agree with this work flow.  Right hand on mouse, left hand on home keys.  Pressing CTRL + Space is done with the left hands, and then you could assign "ea" to "Empty Array" both of which is accessible with the left hand.  Darren posted a bunch of great shortcuts for the right handed developer.
    https://decibel.ni.com/content/docs/DOC-20453
    This is much faster than waiting for any right click menu navigation, even if it is found in the suggested subpalette.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • When and how to update the "saved data" in report ?

    Hi,
    The BO version is "BusinessObjects Enterprise 12.0"
    The case is that, some reports are uploaded withe saved data. while viewing the reports, the reports return the old data.
    How to view the update data while click the "View" in CMC/InfoView ?
    I have tried to schedule it , then can see the update data in "View the latest instance".
    Is there any approach to refresh/update the saved data in the report ?
    Thanks and regards,
    Forest
    Edited by: Forest lin on Dec 5, 2008 12:12 PM

    Hello Forest lin,
    I recommend to post this query to the [BusinessObjects Enterprise Administration|BI Platform; forum.
    This forum is dedicated to topics related to administration and configuration of BusinessObjects Enterprise, BusinessObjects Edge, and Crystal Reports Server.
    It is monitored by qualified technicians and you will get a faster response there.
    Also, all BOE Administration queries remain in one place and thus can be easily searched in one place.
    Best regards,
    Falk

  • How to disable block(update allowed) when data are retrive ?

    Dear mates,
    I have a form where are two blocks one is A_MASTER and A_DETAIL. By default A_DETAIL update allowed property is false. What happen when i insert data ? It's allow data to insert but don't permit to edit the data. So, I write When-New-Recorde-Instance trigger and the code are
    condition
    set_block_property(A_DETAIL,update_allowed,property_true);and the block,*A_DETAIL* is allowed to update.
    Now, i need when the current record(Enter mode) displayed it should be available to update. When the record retrieved later, user can not update or change any thing.
    Thanks,
    problem solved :)
    Edited by: HamidHelal on Dec 10, 2011 11:07 PM

    sorry.

  • Error in parseXML() when data contains "&"

    Hello,
    I have a Subprocess that is a Loop type. I am calling a web service within the loop. The data is pulled using a database adapter. One of the data values I am passing to the service is "Furniture & amp; Office Equipment" (title). Ignore the space between the & and amp;, I did that so it posts properly. The input data association is using this XPath Expression:
    oraext:parseXML(concat("<CreateCostCodes xmlns:v1='http://xmlns.oracle.com/Primavera/CM/WS/Cost/V1'>
    <v1:CostCode>
    <v1:ProjectName>", bpmn:getDataObject('inputData')/ns2:projectName, "</v1:ProjectName>
    <v1:CostCode>", bpmn:getDataObject('costCodes')/ns:costCodes[bpmn:getActivityInstanceAttribute('SUBPROCESS5114801681331', 'loopCounter')]/ns1:costCode, "</v1:CostCode>
    <v1:Title>", bpmn:getDataObject('costCodes')/ns:costCodes[bpmn:getActivityInstanceAttribute('SUBPROCESS5114801681331', 'loopCounter')]/ns1:title, "</v1:Title>
    </v1:CostCode>
    </CreateCostCodes>"))
    My process is failing when it hits the data containing the title that has the & amp; in it. Can someone suggest how to properly parse this?
    Thank you
    Rudy

    Hi Daniel,
    Yes, I have used the "for each" before but in this case the loop is in the subProcess and my web service call is within the subProcess so I don't want to iterate the array in the XSLT. The Loop Characteristics of the subProcess are: Loop and the loop condition is a simple expression "loopCounter <= costCodes.costCodes.length()". I would like to attach an image of the subProcess but I don't see how to do that. To describe it; for each costCode in the array I want to do a read to see if it exists, if it does, update it, else create it, end.
    Thank you.
    Edited by: Rudy Meyer on Nov 15, 2012 9:56 AM

  • How to update flex field data on a human task?

    After entering a human task and assigning the data how do you then update flex field data whilst the task is still assigned. I'm using the task services to communicate with the task and applying filters based on the flex field data.
    I want to update the data when actions take place on the task e.g. suspend, aquire, release.
    Any ideas?

    You can fetch the task , change the flex attribute value and update the task. Find below the steps we do for updating one of the TextAttribute
    Task completeTask =  // get the task using task query service
    completeTask.getSystemMessageAttributes().setTextAttribute2(updatedfolderName);
    completeTask = // update the task using "updateTask" method

  • How to display rows of data in JSP?

    Hi,
    I am learning Servlet and JSP. There is an exercise which requires us to access a database from a Servlet and display the retrieved data in a JSP.
    Now I am ok with the database connection. So how to display the data using some kind of loop?
    Regards

    They're called ResultSets and they are returned when you execute a query from a Statement. The next() method will tell you whether or not you have another row of data to read.

  • How to make search string for the searched text containing single quote?

    Hi all,
    When trying to search some Contacts from Eloqua, I have to make a search string which would list out some specified EmailAddress.
    Unfortunately, I meet several emails who have single quote in their spelling.
    I got 'invalid format' error when both using them directly and making single quote twice.
    Any suggestions?
    Thanks,
    Biao

    When testing, the following examples:
    GET /Api/rest/1.0/data/contacts?search=emailAddress=bm'[email protected]
    GET /Api/rest/1.0/data/contacts?search='emailAddress=bm'[email protected]'
    GET /Api/rest/1.0/data/contacts?search=emailAddress="bm'[email protected]"
    GET /Api/rest/1.0/data/contacts?search="emailAddress=bm'[email protected]"
    All return:
      "elements":
        "type":"Contact",
        "id":"1421620",
        "createdAt":"1419611518",
        "depth":"minimal",
        "name":"bm'[email protected]",
        "updatedAt":"1419611519",
        "emailAddress":"bm'[email protected]"
      "page":1,
      "pageSize":1000,
      "total":1
    Likewise, the following returns nothing:
    GET /Api/rest/1.0/data/contacts?search=emailAddress='bm'[email protected]'
    Hopefully this helps,
    Bojan

  • How to construct a sql query when field having single quote

    Hi all,
    I have been working on web application , here is my requirement:
    I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote.
    while executing the query it is getting problem because of single quote .. so how do i resolve my problem.
    single quote should be there. (I'm using Ms-Access as my database).
    Thanks in advance
    abel

    Use PreparedStatement. Always. It not only eases setting Java objects in a SQL query, but also protects you against SQL injections.
    Prepare yourself: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].

  • How to Update the Basic Data text in Material Master.

    Hi Abapers,
    I have more than 5000 materials for update basic Data text inside Material Master.
    how to update basic data text using abap programe? is there any bapi or normal program?.
    anybody give me sample of this.
    Thanks
    S.Muthu.
    IT Dept.

    Hi
    You can do by using the FM SAVE_TEXT.
    Just populate text into table i_tline.
    Local data declaration
      DATA: l_wa_thead  TYPE thead, " Header
            l_wa_tline  TYPE tline. " Work area for tline
    Populate header
      l_wa_thead-tdobject = c_obj_material.
      l_wa_thead-tdname   = wa_data-matnr.
      l_wa_thead-tdid     = c_id_best.
      l_wa_thead-tdspras  = sy-langu.
      l_wa_thead-tdluser  = sy-uname.
      l_wa_thead-tdfdate  = sy-datum.
      l_wa_thead-tdtxtlines = '1'.
    IF i_tline[] IS NOT INITIAL.
       l_wa_tline-tdformat = c_slash.
       APPEND l_wa_tline TO i_tline.
    ENDIF.
    Text shd start from next line
      l_wa_tline-tdformat = c_slash.
      CONCATENATE c_text wa_data-text
      INTO l_wa_tline-tdline SEPARATED BY space.
    Append the new text to the int table
      APPEND l_wa_tline TO i_tline and l_wa_thead
      C* Local data declaration
      DATA: l_wa_thead  TYPE thead, " Header
            l_wa_tline  TYPE tline. " Work area for tline
    Populate header
      l_wa_thead-tdobject = c_obj_material.
      l_wa_thead-tdname   = wa_data-matnr.
      l_wa_thead-tdid     = c_id_best.
      l_wa_thead-tdspras  = sy-langu.
      l_wa_thead-tdluser  = sy-uname.
      l_wa_thead-tdfdate  = sy-datum.
      l_wa_thead-tdtxtlines = '1'.
    IF i_tline[] IS NOT INITIAL.
       l_wa_tline-tdformat = c_slash.
       APPEND l_wa_tline TO i_tline.
    ENDIF.
    Text shd start from next line
      l_wa_tline-tdformat = c_slash.
      CONCATENATE c_text wa_data-text
      INTO l_wa_tline-tdline SEPARATED BY space.
    Append the new text to the int table
      APPEND l_wa_tline TO i_tline.
      CALL FUNCTION 'SAVE_TEXT'
        EXPORTING
          client          = sy-mandt
          header          = l_wa_thead
          savemode_direct = c_check
        TABLES
          lines           = i_tline
        EXCEPTIONS
          id              = 1
          language        = 2
          name            = 3
          object          = 4
          OTHERS          = 5.
      IF sy-subrc = 0.
        COMMIT WORK.
    endif.

  • How to update Row Object in JSP Page? urgent!!!

    HI,
    I have a JSP Page and I have used jbo:DataSource and jbo:ApplicationModuleTags.
    Step 1: I have created a oracle.jbo.ViewObject view using
    view = ds.getRowSet().getViewObject(); and executed query using view.executeQuery()
    Step 2: I access the Row Object for this view like this
    Row rs = ds.getRowSet().getCurrentRow().
    Step 3: I try to set the attributes for this Row using setAttribute methods like this
    rs.setAttribute("empName","James");
    Step 4: Now I want to update this row. How to update this???
    If i need to get a Transaction object, which object's getTransaction I should use?
    Note: Please note that I haven't used <jbo:Row > tags to access my row. I simply get the Row object from view and want to update certain attributes and commit to database.
    Thanks
    Hari

    Hi Harihara!
    I think the record pointer is still before the first row, because you just executed the query.
    Try one the following statements instead of 'Row rs = ds.getRowSet().getCurrentRow()':
    Row rs = view.first();
    or
    Row rs = ds.getRowSet().first();
    And don't forget to commit your changes if the master process doesn't take care of it already!
    Good Luck!
    Rolf van Deursen.

Maybe you are looking for

  • Key code 24 using control down - no longer works in 10.6

    I have a script that should open a dialog box to make a picture using Copernicus. the command I try to invoke is 'Control ='. here is the script. tell application "Copernicus" activate delay 2 tell application "System Events" key code 24 using contro

  • Error in opening PDF.

    Hello Experts, I have created one smartforms which containt some terms and condition which i want to send as a pdf to set of people. Now i am able to send the smartform as PDF . But when i am trying to open the PDF its shows me some error like 'PDF f

  • Commodity codes for foreign trade

    Hi. I am a FICO support analyst but am currently trying to support SDMM as well while we are recruiting a new support analyst for those modules, so this isn't my area of expertise. We use ECC6. FI, CO, SD, MM, and COPA (costing based) for reporting.

  • JWAX UI Framework for AJAX (Swing Like)

    Wanted to pass this along to Swing Developers. http://www.ajaximpact.com/detail_news.php?id=113 JWAX is a event driven component framework modeled after Swing, SWT and other component based systems for AJAX development. It can be leveraged from clien

  • When will i get my elite plus card

    i just hit elite plus by end of 2014 but i still dont receive my card yet? i still remember my elite card took  almost 2 months to arrive not sure how long gonna take this time here is my best buy member #   {removed per forum guidelines}