Using single quotes

Hi ,
I have to write this in case statement .
1.case when studentname in ('xyz'a') then 'pass' end
Kindly please help me . i want to know how i can give tat single quotes inside the formaula since when i am giving tat it completes a word
Kind Regards
Sudarshan

Hi,
Rephrase the case statement as ,
case when studentname in ('xyz''a') then 'pass' end
(ie) replace the single quote with two single quotes, *'* to *''*
Rgds,
Dpka

Similar Messages

  • Is it possible to use single quotes in a String

    Can we use single quotes and comma in side a string variable...
    Eg: String s=" a ' , ' b ";
    why am i asking was...... when this variable is sent to database, the table automatically recognizes the beginning single quotes and end single quotes to retreive the value from the table....
    Eg for query:
    select code from gm_code where sub_code in(?);
    when we pass those two value to this query.. it have to execute like the following
    select code from gm_code where sub_code in(' a ' , ' b');
    but it is not executing.....
    can you give me some suggestion to resolve this problem..
    Thanks in advance..

    You need two strings, and you don't need to provide the single quotes. The driver does that for you when you use PreparedStatment's parameters.
    ps = con.prepareStatement("select * from foo where bar in (?, ?)");
    ps.setString(1, "a");
    ps.setString(2, "b");
    rs = ps.executeQuery();The actual SQL that's executed is select * from foo where bar in ('a', 'b')

  • Using single quote in pl/sql

    I have a procedure that needs to execute a dynamic query.
    here is my brief code.
    sql_stmt := 'select * from test where default = '|| gc_default || ';
    this is just a part of my code. but the problem is that default column is varchar, so the "gc_default" variable should be wrapped with single quote. it should be like this. select * from career where job = 'DEFAULT';
    does anybody know?
    Thanks in advance.

    Use bind variables
    SQL> var c refcursor
    SQL> var gc_ename varchar2(20)
    SQL> declare
      2      s_sql varchar2(100);
      3  begin
      4      s_sql := 'select * from emp where ename = :x';
      5      open :c for s_sql using :gc_ename;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print c
    no rows selected
    SQL> exec :gc_ename := 'MILLER'
    PL/SQL procedure successfully completed.
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    SQL> exec :gc_ename := 'KING'
    PL/SQL procedure successfully completed.
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
    SQL>

  • FF change single quotes in query string for their url-encode form (%27) and I need use single quotes (I don't care about derivated security problems)

    When I try to enter a url like:
    www.example.com?owner=alex's
    the actual URL the FF send is:
    www.example.com?owner=alex%27s
    I need the first option and I don't know hoy to configure it. Could you help me?

    I think that RFC1738 is outdated and you should look at RFC3986 section 2.2:<br>
    "URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component. If a reserved character is found in a URI component and no delimiting role is known for that character, then it must be interpreted as representing the data octet corresponding to that character's encoding in US-ASCII".<br><br>
    I think that in this case there is no special delimiting role or "reserved purpose" for the character to allow the unencoded use. So I think that the behaviour of Firefox is correct.<br>
    http://www.rfc-editor.org/rfc/rfc3986.txt<br>

  • Mssql single quote problem!

    Hi,
    I user servlet to update MS SQL2000. My problem is there is a single quote inside a text string!
    I can't use double quote for string, as it is not a valid statement for MSSQL. I need to use single quote, but there is single quote inside the string, how can I handle the string?
    String mstrnig="I'm a boy";
    String mSQL = "UPDATE news SET " + "title='" + mstring + "' WHERE code =" + mcode;
    Thanks

    the cleanest and easiest soln is to use preparedStatement.
    PreparedStatement ps = con.prepareStatement("update table comment=? where id = ?");
    ps.setString(1,"That's way to do it");
    ps.setInt(1,8);//some itn value
    ps.execute();

  • Use double quotes in column alias

    Hi,
    I would like to alias a column that would look something like this <University "John Smith"> (without <,> chars).
    I know in oracle when you use aliases you need to enclose the column name in double quotes if there are "special" characters.
    In other words how can I write the query below:
    select 1 as University "John Smith" from dual;
    Thank you
    Edited by: orange_square on Jan 14, 2010 7:39 AM
    Edited by: orange_square on Jan 14, 2010 7:40 AM
    Edited by: orange_square on Jan 14, 2010 7:40 AM

    I might be wrong but I don't think you can use double quoted text inside another double quoted string. I don't think there's an escape character for it.
    But maybe you could use single quotes? Not sure it will suit your needs.
    SQL> select 1 as "University ""John Smith""" from dual;
    select 1 as "University ""John Smith""" from dual
    ORA-03001: unimplemented feature
    SQL> select 1 as "University 'John Smith'" from dual;
    University 'John Smith'
                          1
    SQL>

  • How to open single quote, how to open single quote

    Tried to use single quote marks on keyboard using the apostrophe key but this just places the opening mark comma level how do I do this??  I need to for my uni assignment thanks in advance!!! New MAC user :-)

    What application are you using? In most word processors and page-layout apps, there's the option to turn on "smart quotes"...
    Clinton

  • WLS 9.2: JSP error when attribute enclosed in double vs single quote

    Hi all,
              We are trying to deploy a WAR file on WLS 9.2 on a Unix box. This app uses Struts, and does not use any app-server specific extensions/tags etc. We run into JSP compilations errors when we try to deploy as well as when we run weblogic.appc on the WAR. The errors are generally the same type..."This attribute is not recognized" for multiple Tags that are used...not just Struts tags, but even plain vanilla <jsp:include tags...liks so:
              LookupPO.jsp:102:72: This attribute is not recognized.
              <jsp:include flush="true" page="
              <%=(String)request.getAttribute("selectTile")%>"/>
              ^--------^
              However, if we just change the same tag to use single quotes for attribute values, like so:
              <jsp:include flush="true" page='
              <%=(String)request.getAttribute("selectTile")%>'/>
              then it works fine.
              What throws me off is that these tags in the same double-quoted format work well on other servers such as Sun Java System.
              Changing the double to single quotes for every single tag in our applications 600-odd JSPs will be a huge burden...is there any other way?
              Any help is sincerely appreciated.
              Thanks,
              Vik.
              Edited by vshevde at 03/26/2008 9:09 AM

    quote:
    Originally posted by:
    joeG
    Ok I see what you mean, actually the insert in that fashion
    with MySQL still puts the data in normalized, its just in one
    statement. From the docs:
    INSERT statements that use VALUES syntax can insert multiple
    rows. To do this, include multiple lists of column values, each
    enclosed within parentheses and separated by commas. Example:
    INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
    thanks for the response.
    Oh, that's what you meant. See what happens when you get old,
    you go blind.
    I have two suggestions. First, keep trying with cfqueryparam.
    I don't use it that often myself because the db I work with doesn't
    support it, but, I think it has a list attribute.
    Second, what you are attempting, a loop within a query, is
    intuitively more efficient than putting your query inside a loop.
    This is something I have tested and what I found is that the most
    efficient approach depends on the db. I did not test MySQL, but I
    suggest you do. The gettickcount() function is handy for these
    sorts of tests.

  • 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

  • Can a single quote be used at the beginning of a query string parameter

    Hi all,
    I am a relative newbie and have a newbie question.
    Can a single quote be used at the beginning of a query string parameter passed to a jsp page? Are there any inherant problems with this? Is there a comprehensive list of characters that must be escaped in a query string parameter?
    Example: http://mysite.com/myjsp.jsp?param1='nghdh
    Thanks

    You'll have to escape most non-letter characters before you can pass them as a URL. I don't know if it's necessary for a single quote, but better safe than sorry.
    Either use java.net.URLEncoder(...) or use javax.servlet.http.HttpServletResponse.encodeURL(String). I wouldn't recommend using unescaped characters in your URLs, that might cause pretty funny behavior that's sometimes hard to trace back. Don't worry about decoding it, your JSP/Servlet container will do it when you call javax.servlet.http.HttpServletRequest.getParameter(String).

  • Issue searching a content with a single quote in title using matches

    Hi,
    I'm trying to search a content which has a single quote in its title by using the following code:
    ISCSSearchAPI searchAPI = app.getUCPMAPI ().getActiveAPI ().getSearchAPI ();
    ISCSSearchQuery query = (ISCSSearchQuery)app.getUCPMAPI ().createObject (ISCSSearchQuery.class);
    query.setQueryText(queryText);
    ISCSSearchResponse response = searchAPI.search(scsContext, query);
    when the query text is: dDocTitle <matches> `What's New`
    an exception occurs:
    Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
    Exception in thread "main" com.stellent.cis.client.command.CommandException: Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
         at com.stellent.cis.server.api.scs.impl.SCSCommand.executeRequest(SCSCommand.java:338)
         at com.stellent.cis.server.api.scs.impl.SCSCommand.execute(SCSCommand.java:222)
         at com.stellent.cis.client.command.impl.services.CommandExecutorService.executeCommand(CommandExecutorService.java:57)
         at com.stellent.cis.client.command.impl.CommandFacade.executeCommand(CommandFacade.java:158)
         at com.stellent.cis.client.command.impl.BaseCommandAPI.invokeCommand(BaseCommandAPI.java:84)
         at com.stellent.cis.client.api.scs.search.impl.SCSSearchAPI.search(SCSSearchAPI.java:52)
         at com.guycarp.cm.service.ContentQueryService.search(ContentQueryService.java:133)
         at com.guycarp.cm.service.ContentQueryService.main(ContentQueryService.java:168)
    Caused by: com.stellent.cis.server.api.scs.request.SCSRequestException: Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.checkBinderForErrors(SCSRequestProcessor.java:357)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.validateResponse(SCSRequestProcessor.java:273)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.processRequest(SCSRequestProcessor.java:118)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:61)
         at com.stellent.cis.server.api.scs.request.stream.SCSOptimizedPublishFilter.handleRequest(SCSOptimizedPublishFilter.java:128)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.stream.SCSOptimizedRetrieveFilter.handleRequest(SCSOptimizedRetrieveFilter.java:250)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.rewrite.SCSRewriteURLFilter.handleRequest(SCSRewriteURLFilter.java:140)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.cache.impl.SCSServiceCacheFilter.handleRequest(SCSServiceCacheFilter.java:104)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestExecutorProxy.execute(SCSRequestExecutorProxy.java:105)
         at com.stellent.cis.server.api.scs.impl.SCSCommand.executeViaProxy(SCSCommand.java:353)
         at com.stellent.cis.server.api.scs.impl.SCSCommand.executeRequest(SCSCommand.java:335)
    but the query text dDocTitle <contains> `What's New`
    works fine.
    Is there any escape character that I should be using for the single quote when we use <matches> operator?
    Facing the same issue when searching from the content server console.
    Any idea!
    Thanks,
    Anil

    There seems to be none OOTB, but you can define it, see http://docs.oracle.com/cd/E25054_01/doc.1111/e10792/c05_search.htm#CHDIEECF

  • How to search the location of the single quote using instr func in a string

    I have a string '345634','234'(all 4 single quotes are part of the string) and I want to find the location of the 3rd single quote using the instr function , could sum1 quickly please help me out.
    Regards
    Rahul
    Edited by: Rahul Kalra on Aug 26, 2010 8:58 AM

    Carlovski wrote:
    You really do learn something new every day!
    It really is quite ugly syntax though.Not really. You can use whatever character you want to indicate the start and end of the string, but if you use any of the brackets "[", "(" or "{" you should terminate using the opposing bracket "]", ")" or "}" respectively. It also looks a bit more ugly with data like that, but if you are entering regular text then it looks ok...
    e.g.
    SQL> select q'[This is my string with fred's quotes in it]' as mystring from dual;
    MYSTRING
    This is my string with fred's quotes in it
    SQL> select q'(This is my string with fred's quotes in it)' as mystring from dual;
    MYSTRING
    This is my string with fred's quotes in it
    SQL> select q'{This is my string with fred's quotes in it}' as mystring from dual;
    MYSTRING
    This is my string with fred's quotes in it
    SQL> select q'.This is my string with fred's quotes in it.' as mystring from dual;
    MYSTRING
    This is my string with fred's quotes in it
    SQL> select q'#This is my string with fred's quotes in it#' as mystring from dual;
    MYSTRING
    This is my string with fred's quotes in it
    SQL> select q'`This is my string with fred's quotes in it`' as mystring from dual;
    MYSTRING
    This is my string with fred's quotes in it
    SQL>Well... almost any character...
    SQL> select q'¼This is my string with fred's quotes in it¼' as mystring from dual;
    ERROR:
    ORA-01756: quoted string not properly terminated

  • Can I quote a single quote character so that I can use it in Replace()

    Hi. How can I quote a single quote character so that I can use it in the Replace() function below. I'm attempting to query first_name records that contain a '.
    select first_name, last_name
    from ttms.prospect
    where instr(first_name,"'") > 0
    ERROR at line 3:
    ORA-00904: "'": invalid identifier

    Hi,
    String literals are enclosed in single-quotes (not double-quotes).
    To use a single-quote within a string literal, use two of them:
    WHERE   INSTR (first_name, '''') > 0In Oacle 10 (and up) you can also use Q-Notation:
    WHERE   INSTR (first_name, q'[']') > 0but you may find this more confusing for short literals containing only one single-quote.
    Edited by: Frank Kulash on Mar 11, 2009 4:52 PM

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

  • Single quote used with in text data renders to inalid display

    I have the following text snipit that is coming from an Oracle database column: ...did not include 'special decontamination'. New ...
    I am putting this into a pretty standard text object.  When the report is previewed and subsequently printed as a PDF each single quote is transformed to the text string &_#_3_9_; code (without the underscores). This also occurs for quotation marks appearing as &_q_u_o_t_; and ampersands appearing as &_;_a_m_p_;
    I've tried changing the text interpretation property from none to rtf and, with a refresh, nothing changed.  It is hard for me to believe that no one else has seen this but since you can not search the forum for this string (as it converts it to the single quote) may not one has asked.
    Thanks in advance.

    Hi Don,
    The CLOB would do it. 
    Not sure there is a way around this aside from how you've already been dealing with it. 
    To simply your formula a bit, you don't need to do a loop just have it check for each of the tags like:
    stringVar TempText := {PPR_Main.CONCERNS};
    TempText := Replace (TempText, '&_#_3_9_;', "'") ;
    TempText := Replace (TempText, '&_;_a_m_p_', "&") ;
    TempText := Replace (TempText, '&_q_u_o_t_;', '"') ;
    TempText
    I agree though that there may be other tags added later on based on other characters so it could be infinite.  Try the common characters like Exclamation and Question marks. 
    Good luck,
    Brian

Maybe you are looking for

  • To find error message in the standard program sapmv45a

    Hi friends, I have a following senario. Iam getting the following error mesage. INFO RECORD FOR VENDOR 'ABC' AND MATERIAL '00000678' DOES NOT EXIST. now my requirment is i should find from were this error message is being triggered. actualy my proble

  • I want to delete a single contact from history.

    Hi!! I want to delete a single contact from history. I have read that few users have asked similar questions in the past as well and also I have found some of them answering or rather questioning why one will like to delete a single log from the hist

  • Lion MacBook Performance Slow On Battery

    Hi, Few days ago I dropped water on my laptop and I managed to fix it, things are fine now. However, I notice that the performance on my MacBook is very slow and annoying when it is working on Battery.. and its very smooth, fine and fast enough when

  • Cursors!!! I am new to them, please help!!!

    I am new to PL/SQL and learning about cursors and I came up upon an example but I am stumped. Here it is: Let us start with a small sub-program as follows: declare type r_cursor is REF CURSOR; c_emp r_cursor; en emp.ename%type; begin open c_emp for s

  • Cannot close apps

    It has been many a times that i cannot close all the apps. Even if i close e.g an app say calendar then too it will show the circle which means it is opened. If at all the calendar is closed then some other app will get opened say gallery or so. When