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')

Similar Messages

  • Any possiblity to use single Inbound Service Interface with multiple Receiver Agreements

    Hi All,
    Scenario: PROXY to FILE.
    Requirement is to receive to two locations.
    Is it possible to use single Inbound interface with multiple Receiver Agreements. I tried using two operation in the Inbound Service Interface, and Operation Specific in Determination. But couldnt proceed further. Do I need to use seperate Service Interface for two receiver locations?
    Please suggest some solution.

    Hi Naveen,
    There is a possibility but in the case in the same server location with dynamic configuration: Placing file in two different directories using single receiver communication Channel
    With different location you would need to develop a new adapter module as Amit Srivastava explains and develops here Send File to Two Different Locations using Adapter Module
    Regards.

  • 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

  • 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? ;)

  • Is it possible to use the value of a string to reference a component in the

    I'm fairly new to Java so this may be a stupid question!
    Is it possible to use the value of a string to reference a component in the code? For example in the code below, Wall is a class holding 3 different arrays. The Robot class has an array called finishBricks. When the buildWall method is run it receives the integers width and height which are used to construct the dimensions string. I want to use this string to then load the appropriate Wall array into the finishBricks array.
    I hope this makes sense! Any help would be greatly appreciated!
    class Robot {
    public double[][] finishBricks;
    public void buildWall(int width, int height) {
    Wall w = new Wall();
    String dimensions = "Wall" width "x" +height;
    this.finishBricks = w.xxxx; // where xxxx is replaced by whatever the String dimensions is
    class Wall {
         public double[][] Wall4x2 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-13.55,27.45},
              {-30.00,-20.35,27.45},
              {-30.00,-22.00,28.65},
              {-30.00,-16.85,28.65},
              {-30.00,-10.05,28.65},
              {-30.00,-03.25,28.65}
         public double[][] Wall3x3 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-13.55,27.45},
              {-30.00,-15.20,28.65},
              {-30.00,-10.05,28.65},
              {-30.00,-03.25,28.65},
              {-30.00,-01.60,29.85},
              {-30.00,-06.75,29.85},
              {-30.00,-13.55,29.85},
         public double[][] Wall2x4 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-08.40,28.65},
              {-30.00,-03.25,28.65},
              {-30.00,-01.60,29.85},
              {-30.00,-06.75,29.85},
              {-30.00,-08.40,31.05},
              {-30.00,-03.25,31.05},

    Map walls = new HashMap ();
    walls.put ("2x2", new double[][] {
        new double[] {
            1,
            0
        new double[] {
            0,
            1
    double[][] wall = (double[][]) walls.get ("2x2");

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

  • 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

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

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

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

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

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

  • Is it possible to use single ssl certificate for multiple server farm with different FQDN?

    Hi
    We generated the CSR request for versign secure site pro certificate
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}
    SSL Certificate for cn=abc.com   considering abc.com as our major domain. now we have servers in this domain like    www.abc.com,   a.abc.com , b.abc.com etc. we installed the verisign certificate and configured ACE-20 accordingly for ssl-proxy and we will use same certificate gerated for abc.com for all servers like www.abc.com , a.abc.com , b.abc.com etc. Now when we are trying to access https//www..abc.com or https://a.abc.com through mozilla , we are able to access the service but we are getting this message in certfucate status " you are connected to abc.com which is run by unknown "
    And the same message when trying to access https://www.abc.com from Google Chrome.
    "This is probably not the site you are looking for! You attempted to reach www.abc.com, but instead you actually reached a server identifying itself as abc.com. This may be caused by a misconfiguration on the server or by something more serious. An attacker on your network could be trying to get you to visit a fake (and potentially harmful) version of adgate.kfu.edu.sa. You should not proceed"
    so i know as this certficate is for cn=abc.com that is why we are getting such errors/status in ssl certficate.
    Now my question is
    1. Is is possible to  remove above errors doing some ssl configuration on ACE?
    2. OR we have to go for VerisgnWildcard Secure Site Pro Certificate  for CSR generated uisng cn =abc.com to be installed on ACE  and will be used  for all servers like  www.abc.com , a.abc.com etc..
    Thanks
    Waliullah

    If you want to use the same VIP and port number for multiple FQDNs, then you will need to get a wildcard certificate.  Currently, if you enter www.abc.com in your browser, that is what the browser expects to see in the certificate.  And right now it won't beause your certificate is for abc.com.  You need a wildcard cert that will be for something like *.abc.com.
    Hope this helps,
    Sean

  • HT1751 Is it possible to use single external iTunes Library from multiple computers (my mac book, pc, mac mini)

    Hi,
    I recently decided to maintain my itunes libraries distrubuted onto different computers. (such as mac mini, mac book, pc)
    I am planning to consolidate one of my iTunes library, move it to external source and configure external hard drive to be used by my iTunes library permanently.
    For this purpose, I bought 5big NAS pro network storage hardware. I completed all basic setup and now I need help on designing access methodology.
    Question is : Does external iTunes library supports to be used by more than one iTunes application? if not what will be the closest solution to save storage and ease of library management?
    Thanks in advance
    Serhan

    Hi,
    I recently decided to maintain my itunes libraries distrubuted onto different computers. (such as mac mini, mac book, pc)
    I am planning to consolidate one of my iTunes library, move it to external source and configure external hard drive to be used by my iTunes library permanently.
    For this purpose, I bought 5big NAS pro network storage hardware. I completed all basic setup and now I need help on designing access methodology.
    Question is : Does external iTunes library supports to be used by more than one iTunes application? if not what will be the closest solution to save storage and ease of library management?
    Thanks in advance
    Serhan

  • Is it possible to use single communication channel

    Hi,
        I have created a RFC(sender) CC for one scenario (RFC ->XI -> SOAP).
    Now I have got same scenario but the SOAP target service is different. Hence created new CC for target SOAP(receiver).
    But the sender SAP system is same, So, Can I use the same RFC(sender), will there be any conflict arise?? or should I need to define one more RFC(sender)
    Thanks
    RDS

    hi
    no problem you can use the same communication channel...just add to u r scenario...
    Note: reward points if solution found helpfull
    Regards
    Chandrakanth.k

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

Maybe you are looking for