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

Similar Messages

  • How can I will declare the symbol u2018 (Single Quote) in the report

    Hi ,
    Could you please tell me how can I will declare the symbol u2018 (Single Quote) in the report.
    My requirement is that I have concate the data with single quote and after that I have to store the data in to an internal table and I have to download the data in the form text file in the presentation server.
    For example :
    Let the below data I want to download into the presentation serve in the format of text file by storing in internal table.
    Assume all are constants:
    1st line : abcu2019add
    2nd line :  defu2019gef
    Thanks in advance.

    Hi Jyothi,
    Thanks for the quick reply .
    I can agree with you are point but My requirement is like this I am explaining clearly.
    I have declared the internal table like this.
    DATA: BEGIN OF OTAB OCCURS 0,
             LINE (9024),
           END OF OTAB.
    So I have to append the each line item into the internal table.
    So I am explaining what the data I have to append
    Ist line contains
    'UNBUNOC:2020308u2019 where 020308 I will get the  date from reguh table
    2nd line contains:
    'DTM+20020510' where the 20020510 will be reference document number from the table reguh.
    So I want to declare a constant 'UNBUNOC:2
    2nd the date from reguh table
    And another constant u2018
    So that I can concate all the three and I can put into string and I will append into internal table and I can download the data into the presentation server.
    Please let me know if you need any more clarification regarding my requirement.
    Thanks in advance.

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

  • How to insert a string containing a single quote to the msql database? help

    how can i insert a string which contains a single quote in to database... anyone help
    Message was edited by:
    sijo_james

    Absolutely, Positively use a PreparedStatement. Do not use sqlEscape() function unless you have some overriding need (and I don't know what that could possibly be).
    There are 1000's of posts on the positive aspects of using a PreparedStatement rather than using a Statement. The two primary positive attributes of using a PreparedStatement are automatic escaping of Strings and a stronger security model for your application.

  • Can we have a Single quote in the tooltip text?

    Hi,
    We have some tooltips for the presentation columns which contains a single quote.
    When I try to view the tooltip from answers the single quote is being replaced by double quotes.
    I tried to use all sorts of escape characters for single quote, like "\'" and ''' and "'" but that didn't work.
    Is there any way to do this.
    Thanks!!
    Vasantha.P

    As I said in my earlier post, I am looking for the tooltips for the Presentation tables and columns. The tooltips for these were extracted from the RPD using the externalize Strings option and these externalized strings are stored in the database.
    So I am escaping the single using a single quote both in rpd and in the database.
    Example text I have used both in the rpd and database is something like "Shipment's start time". I tried with "Shipment''s start time", " Shipment'''s start time", but it didn't work.
    Thanks!!
    Vasantha.P

  • Adding a single quote in the flash chart legend

    Hi all,
    I am using a following code to create a line chart.
    SELECT null link
    ,TO_CHAR(monat, 'MON-YY')
    ,ROUND(No_of_hits/1000) "No of Clicks(''000)"
    FROM
    SELECT DISTINCT TRUNC(ref_month,'MONTH') monat
    ,SUM(no_of_hits) OVER (ORDER BY TRUNC(ref_month,'MONTH') RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) No_of_hits
    FROM goodnews_hits
    WHERE ref_month BETWEEN :p77_DATE_startline
    AND :p77_DATE_endline
    ORDER BY monat;
    I get the following legend in the top region of the chart
    No Of Stories
    No of Clicks(''000)
    I need the No of Clicks to be displayed as
    No of Clicks('000)
    i.e.
    Only one single quote before 000
    Could you please tell me , how this can be achieved?
    Thanks,
    Archana

    As I said in my earlier post, I am looking for the tooltips for the Presentation tables and columns. The tooltips for these were extracted from the RPD using the externalize Strings option and these externalized strings are stored in the database.
    So I am escaping the single using a single quote both in rpd and in the database.
    Example text I have used both in the rpd and database is something like "Shipment's start time". I tried with "Shipment''s start time", " Shipment'''s start time", but it didn't work.
    Thanks!!
    Vasantha.P

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

  • Single quote in the query

    Hi,
    I am inserting a string literal that contains one or more single quotes. I know i have to use two single quote ('') to represent one single quote in my insert query and four single quotes('''') to show two single quotes. However, when i do a select from the table, all single quotes are escaped with a backslash in front of it (\'). This cause some problem when i display the string in html page. How can i skip the back slash and keep only the single quote in my select query? Thanks
    Kim Titu

    Kim,
    To insert single quote or double quote string try using the ascii values as below -
    CHR(34) ==> " (double quote)
    CHR(39) ==> ' (single quote)
    Example:
    Insert into emp(EMPNAME) values(CHR(39)||'TEST'||CHR(39));
    Now,
    Select EMPNAME from emp;
    will give you the result - 'TEST'
    Regards,
    Murali Mohan

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

  • Insert single quote into the table

    Hi
    I have to insert values into a column that are retrieved by a select query on another table.
    The values inserted have single quotes (').
    Does anybody know how to do it?
    Thanks in advance

    If you get from one table and then insert in the other there shouldn't be any problem at all.
    SQL> create table blah_one as
      2  select 'Radha''s Sarma' col from dual
      3  /
    Table created.
    SQL> select * from blah_one
      2  /
    COL
    Radha's Sarma
    SQL> create table blah_two as
      2* select col from blah_one
    SQL> /
    Table created.
    SQL> select * from blah_two
      2  /
    COL
    Radha's Sarma
    SQL>Cheers
    Sarma.

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

  • 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