How to escape a single quotes from a string of dynamic sql clause?

if a single quotes exist in a dynamic sql clause for a string,
like
v_string :='select tname from tab where tabtype='table'',
there tabtype='table' will conflict with the single quote ahead.
could somebody tell me how to escape this single quotes?
thanks for your tips,
frederick

fredrick,
To represent one single quotation mark within a literal, enter two single quotation marks. For example :
v_string :='select tname from tab where tabtype=''table'''
Regards,
Srinivas

Similar Messages

  • How to escape the single quote from email value?

    Hi,
    Is there any way to escape the special character single quote from the email value.
           String ownerQry = "Select Id, email from User where email in('0000'";
            for(int i=0; i<accountData.length; i++)
                ownerQry += ",'" + accountData.TEAM_EMAIL+"'";
    ownerQry += ")";
    QueryResult qrTeam = sfdcCtrl.query(ownerQry);
    When i tried to set the email value on a custom object, its throwing the error as below  and failed to update. <xml-fragment xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><faultcode>sf:MALFORMED_QUERY</faultcode><faultstring>MALFORMED_QUERY:
    '[email protected]','brenden.o'[email protected]','[email protected]'
    ^ ERROR at Row:1:Column:963 expecting a right parentheses, found 'connor'</faultstring><detail><sf:fault xsi:type="sf:MalformedQueryFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com"><sf:exceptionCode xmlns:sf="urn:fault.enterprise.soap.sforce.com">MALFORMED_QUERY</sf:exceptionCode><sf:exceptionMessage xmlns:sf="urn:fault.enterprise.soap.sforce.com">
    '[email protected]','brenden.o'[email protected]','[email protected]'
    ^ ERROR at Row:1:Column:963 expecting a right parentheses, found 'connor'</sf:exceptionMessage><sf:row xmlns:sf="urn:fault.enterprise.soap.sforce.com">1</sf:row><sf:column xmlns:sf="urn:fault.enterprise.soap.sforce.com">963</sf:column></sf:fault></detail></xml-fragment>

    Thanks Dr.Clap.
    I think its very tricky to implement this.
    Here is the SOQL query. i am passing all the email values.
    Select Id, email from User where email in('0000','o\'[email protected]','[email protected]')
    These values are coming from oracle DB table in the form of array accountData[].TEAM_EMAIL
            String ownerQry = "Select Id, email from User where email in('0000'";
            for(int i=0; i<accountData.length; i++)
               ownerQry += ",'" + accountData.TEAM_EMAIL+"'";
    ownerQry += ")";the array value may contain the email with single quote before @gmail.com which i need to ignore. :-( i think this is very tricky. who knows the solution for this?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to escape a single quote in a find mode view

    Hello,
    I'm working with JDeveloper 10g.
    I've defined a view that is used in "find mode" in a JSP.
    When a value with a single quote is inserted in a field of the search form, an exception is thrown:
    JBO-27122: SQL error during statement preparation.
    ORA-00907: missing right parenthesis.
    The problem is that the "single quote" is not being escaped:
    WHERE STREET LIKE 'ABAT ESCARRE, DE L'A'
    How could I force the view to escape the "single quote"?
    Thanks

    Arrest the single quote by calling a javascript method.
    This might help you
    Re: af:clientListener javascript function call question
    http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_clientListener.html
    Edited by: Srinidhi on Mar 23, 2011 3:46 PM

  • Escape single quote from a String variable

    Hi,
    I have a String variable called "name" which i am using in my form tag.
    <form name=test action="test.jsp?fname=<%=name%>" method="post">
    But i am getting Javascript error if the "name" variable contains a string with some special characters like single quote( ' ).
    Plz help me to escape this special char from my String variable.
    Thanks..

    You need to url-encode the value using the URLEncoder class.
    http://java.sun.com/javase/6/docs/api/java/net/URLEncoder.html
    For example:
    <form name=test action="test.jsp?fname=<%=URLEncoder.encode(name, "ISO-8859-1")%>" method="post">

  • How do I pass single quotes into a string variable?

    Thanks for any help?
    Example
    Select xdat, yday
    from foo
    where
    xdat = to_char(sysdate, 'mm/dd/yyyy')
    How do I pass the single quoted stuff above into a string variable?

    Thank you but that is not the same thing. I am building a dynamic sql statement and need to pass the quoted material into a statement that is quoted Is that not what my example above shows?
    My example above has a quoted string inside a string. I think this is exactly what you were asking for.

  • How to parse out curly quotes from a string

    Hi,
    I am writing a web application, where people will be copying from a Word Document into a text area. Then I get a String from the parameter passed.
    How can I parse out curly quotes and mdashes from this String? Are there specific character codes that I can parse out to replace them with regular quote characters or html quote characters?
    Thanks,
    Gabe

    Interesting problem and one that we had to deal with a couple of years ago. I think you might be talking about smart quotes and these are actually control characters used by MS products. They show up as squares in HTML unless properly dealt with. Try downloading some UNICODE charts to find out the values of these characters. I think they are something like 0044 and 0042 but I cannot remember off hand.

  • How to get a single quote in a string

    this is my code, how do i get a * ' * around the :p2_marketingcode so that the result will be
    and marketingcode_id LIKE 'SP09663'
    i tryed something like this ||'''||:p2_marketingcode||''';
    if :p2_marketingcode is not null then
    q:=q||' and marketingcode_id LIKE '||:p2_marketingcode;
    end if;

    Try:
    if :p2_marketingcode is not null then
    q:=q||' and marketingcode_id LIKE '''||:p2_marketingcode||'''';
    end if;

  • How to pass a single quote in a URL using Javascript

    Can someone tell me how to pass a single quote in a URL using Javascript. I have created a Javascript funciton in which I pass several column values from an APEX report.
    The URL for the report link I am using is "JAVASCRIPT:passBack('#EMP_ID#','#Name#','#e-mail#')"
    The problem occurs with the Name and e-mail columns contain a single quote (i.e. James O'Brien)

    Thank you Saad, that worked.
    Since I built the report using type 'SQL Query (PL/SQL function fody returning SQL query)' I had to add some additional quotes to get it to work.
    i.e.
    replace(EMP_EMAIL_NAME,'''''''',''\'''''')
    or
    replace(EMP_EMAIL_NAME,chr(39),''\'''''')
    Thanks for the help,
    Jason

  • How to use a single quote string in where condition

    Hi,
    I have one problem in building a query.
    SELECT agx_drug_indication.record_id, agx_drug_indication.fk_ad_rec_id,
    agx_drug_indication.drugindicationmeddraver, agx_drug.record_id,
    agx_drug.fk_apat_rec_id,
    REPLACE (agx_drug.medicinalproduct, '''', '''') AS "MEDICINALPRODUCT",
    pack_imp_objects.fn_get_arisg_code
    (147,
    agx_drug_indication.drugindicationmeddraver
    ) AS "DRUGINDICATIONMEDDRAVER",
    agx_drug.drugindication,
    NVL (agx_drug.drugcharacterization, 1) AS "DRUGCHARACTERIZATION",
    agx_safety_report.record_id, agx_safety_report.case_identifier_no,
    agx_safety_report.fk_apat_rec_id,
    pack_imp_objects.fn_meddra_llt_matching
    (agx_drug_indication.drugindication,
    agx_drug_indication.drugindication,
    agx_drug_indication.drugindicationmeddraver,
    1
    ) AS "LLT_CODE",
    pack_imp_objects.fn_meddra_soccode_matching
    (agx_drug_indication.drugindication,
    agx_drug_indication.drugindicationmeddraver
    ) AS "PRIMARY_SOC_CODE",
    pack_imp_objects.fn_meddra_soccode_matching
    (agx_drug_indication.drugindication,
    agx_drug_indication.drugindicationmeddraver
    ) AS "CASE_SOC_CODE",
    pack_imp_objects.fn_meddra_pt_matching
    (agx_drug_indication.drugindication,
    agx_drug_indication.drugindication,
    agx_drug_indication.drugindicationmeddraver
    ) AS "PT_CODE",
    pack_imp_objects.fn_get_aer_id (11) AS "AER_ID"
    FROM agx_drug_indication,
    agx_drug,
    agx_safety_report
    WHERE agx_drug_indication.fk_ad_rec_id = agx_drug.record_id
    AND agx_drug.fk_apat_rec_id = agx_safety_report.fk_apat_rec_id
    AND agx_safety_report.case_identifier_no IS NOT NULL
    AND agx_drug_indication.drugindication IS NOT NULL
    AND agx_drug.medicinalproduct =
    REPLACE ('*-qVAGX_DRUG.MEDICINALPRODUCT*', '''', '''')
    In the above query last line '-qVAGX_DRUG.MEDICINALPRODUCT' is a dynamic variable which may or may not contain the single quotes.
    Ex: ABC's or just ABC.
    The query has to support both single quote and without quote in it.
    I wanted everything to be done in the sinlq query on not a PL/SQL Block.
    Please help me ASAP

    kumar0828 wrote:
    <font color="#FF0000"> ... </font>
    REPLACE (agx_drug.medicinalproduct, '''', '''') AS "MEDICINALPRODUCT",
    <font color="#FF0000"> ... </font> <pre>
    REPLACE (agx_drug.medicinalproduct, '<font style="background-color: #E7FA6B">''</font>', '<font style="background-color: #E7FA6B">''</font>')
    </pre>
    With the above statement you are replacing single quote with another single quote
    (which is nonsense).
    <font color="#FF0000"> ... </font>
    AND agx_drug.medicinalproduct = REPLACE ('*-qVAGX_DRUG.MEDICINALPRODUCT*', '''', '''')
    In the above query last line '-qVAGX_DRUG.MEDICINALPRODUCT' is a dynamic variable which may or may not contain the single quotes.This is not a dynamic variable but a string value:
    <pre>
    AND agx_drug.medicinalproduct =
    REPLACE (<font style="background-color: #FF3D55">'*</font>-qVAGX_DRUG.MEDICINALPRODUCT<font style="background-color: #FF3D55">*'</font>, '<font style="background-color: #E7FA6B">''</font>', '<font style="background-color: #E7FA6B">''</font>')
    </pre>
    *-qVAGX_DRUG.MEDICINALPRODUCT* <pre>
    AND agx_drug.medicinalproduct =
    REPLACE (<font style="background-color: #FF3D55">q'*</font>-qVAGX_DRUG.MEDICINALPRODUCT<font style="background-color: #FF3D55">*'</font>, '<font style="background-color: #E7FA6B">''</font>', '<font style="background-color: #E7FA6B">''</font>')
    </pre>
    -qVAGX_DRUG.MEDICINALPRODUCT q'[a]' => a
    q'[a']' => a'
    q'[a'']' => a''
    q'*a*' => a
    q'*a'*' => a'
    q'*a''*' => a''
    A variable also cannot contain a dot (.):
    <pre>VAGX_DRUG<font style="background-color: #FF3D55">.</font>MEDICINALPRODUCT</pre>
    Ex: ABC's or just ABC.
    The query has to support both single quote and without quote in it.
    I wanted everything to be done in the sinlq query on not a PL/SQL Block.
    Please help me ASAPTry this:
    <pre>
    AND agx_drug.medicinalproduct = MY_VARIABLE
    </pre>

  • How to delete a single request from DSO in BI 7.0

    Dear Experts,
    Could you please tell me how to delete a single request from DSO?
    I mean, in DSO if we delete one request it also delete the requests which are above it. But i don't to delete the above it.
    Please suggest me this issue.
    Regards,
    Prathap

    IN DSO--its a very basic thing....
    ACTIVE TABLE and CHANGELOG tables are overwritten after activation of each request.
    So ,each new request has a realationsip with the older request.
    So in the cases:
    1.If you activate the older request it will delete the new one ,because changelog entries have been written from the data of new request on the basis of the older one.
    e.g older request  entries:
    a x 1
    new request
    a x 2
    change log
    a x 1
    a x -1
    a x 2
    so its quite obvious you can't have  a x 2 directly (because in the infocube you will be sending wrong entries by deleting the just the older request and loadning new request).
    2.If you have activate new and old request toghterh then also system will not allow you to delete the newer request alone and you will have to delete both the requests.
    I guess already someone proposed correct solution to you ...thats selective deletion...but rahter than doing selective deletion there is a better way if you want to cancel out a particular request:
    thats request reverst posting
    IN the process monitor of any particular request you can find out the option for request reverse posting..Its good for individual request cancellation(keyfig values will become 0 for that particular request)
    regards,
    rk

  • How to escape the double quote in URL

    Hi,
    I know that using backslash we can escape the ',' while sending the data between pages using URL.
    Can any body please help me how to escape the double quotes.
    Thanks a lot.

    Thanks again for the reply and now I am able to encrypt and decrypt my document number... one more question please : will it be possible to chnage the whole URL to some basic message type URL for eg:
    let's say our URL is "http://testdoc/post?mssg" and I want to change this to as "OPEN DOCUMENT" and when user clicks on ""OPEN DOCUMENT" it will still direct to the original destination that is our original URL.
    I have been told that we don;t want to maintain custom table until and unless it's our last choice.
    Thanks,
    Rajat

  • How to Delimit the Single quotes ( ' )

    Hi friends.
    how to delimite the single quotes ( ' )  or
    how to move the single quotes in fields.
    any body pls reply
    thanks
    pauldharma

    Hi,
    Use for single quotes and that will result in a single quote.
    i.e.
    lv_quote = ''''.
    Darren

  • I cant read correct single quote from mySQL database...

    I cant read correct single quote from mySQL database, pls help. What i'm talking about. I must import, "J'adore" for example in my DB and I'm doing this. Thats ok. But when I try to read this value from my DB through JDBC I'm receiving SQL exception (because JDBC thinks that i didn't close may quote). If somebody knows solution for this problem lets tell me.

    I'm not sure I got your question correctly, but maybe
    this solves your problem:
    Connection conn = // Wherever you get it from
    PreparedStatement query =
    = conn.prepareStatement("INSERT INTO table_A (field_A) VALUES (?)");
    query.setString(1, "J'adore");
    query.execute();
    query.close()Regards, Eirikthe select variation which i think you mean the WHERE clause would be...
    Connection conn = // Wherever you get it from
    PreparedStatement query = conn.prepareStatement("SELECT * FROM table_A WHERE field_A = ?");
    query.setString(1, "J'adore");
    ResultSet rs = query.executeQuery();

  • Finding location of single quote ( ' ) in a string

    Hi,
    I have a need to find the location of second single quote in a string.
    Below query works fine for a string without single quote. It gives me the location of word 'HIER' for 2nd occurrence.
    select instr('HIER A HIER B','HIER',2) from dual
    I want to do the same with single quote. I am trying with the below query.
    select instr('HIER A '' HIER B ''',chr(39),2) from dual
    But it always gives me the location of first occurrence of single quote and not the second.
    Any idea about this issue..?
    Thanks

    select regexp_replace('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','.*''(.*)''.*','\1') from dual
    select substr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ',instr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','''')+1,instr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','''',1,2)-instr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','''')-1) from dualComment to the second approach: check SUBSTR() syntax, the second numeric parameter is length of the fragment, not the ending position. Still, RE approach is way shorter and more readable, isn't it? ;)

  • Single quote in the String????

    Hello All,
    I want to supress the meaning of single quote in the string, so that I can use the string as one of the fields in my sql query, for doing this inserting "/" before the single code is the way or is there any other standard way to achieve this.
    Thanks in Advance,
    Sarada.

    usually you need to use the scape character for stopping the meaning of a single qoute, or even double quite \', \"
    String s = "select empname from emps where id=\'123\'" ;
    Regards

Maybe you are looking for

  • Completely frustrated by iBooks Author and iBooks

    I have been writing in iBooks Author for a while to produce a book. I loved what was shown by Apple as possibilities. My book contains a lot of diagrams, the source material are vector images (SVG or PDF). These images are sometimes large and are unr

  • Change default language for SharePoint Online Sub-Site

    Hi Guys, Am trying to create multiple sub-sites using a custom site template in SharePoint Online. The default language of the Site Template is English. But I want to create sites for difference languages. There is a option to setup multiple language

  • JButton in inner class  cuasing Null Pointer Excp

    Ok so i have this class called "square" and in it there is a JButton. There is a method called createButton() and getButton(). In create button it takes the classes JButton called button and instantiates: public void createButton() { button = new JBu

  • Mass processing by T.code COOIS

    Hi, How can I execute some mass processing in the T.CODE COOIS and  not only reporting. I canu2019t use u201Csettingsu201D and u201Cmass processingu201D in my system. They are deactived. Do I need some customizing. Thanks Dede

  • PL/SQL Function source of text field

    I have the following code as a PL/SQL function body as the source of a text item. There is a group_options table that specifies if the user group selected has fixed pricing or can key in a price. For the fixed price groups, I was wanting to have the