String value changes single quote ' to double quote "

I am creating a list with different bill codes within single
quotes as follows
<cfset corlist = " '1100 ','1200 ','1300 ','1700 ','1800
','1950 ','7001 ' ">
when I do an output
for
<cfoutput>AND idbillcode IN ( #corlist
#)</cfoutput>
I get the values as follows
AND idbillcode IN ( '1100 ','1200 ','1300 ','1700 ','1800
','1950 ','7001 ')
However when I put the same string within a cfquery the
single quotes get replaced by double quotes as follows
AND idbillcode IN ( ''1100 '',''1200 '',''1300 '',''1700
'',''1800 '',''1950 '',''7001 '') which throws an error.
Anybody has any clues.
Thanks.

However when I put the same string within a cfquery the
single quotes
get replaced by double quotes as follows
AND idbillcode IN ( ''1100 '',''1200 '',''1300 '',''1700
'',''1800
'',''1950
'',''7001 '') which throws an error.
Anybody has any clues.
That is ColdFusion escaping the single quotes, by doubling
them so that
you can search for strings such as "singhpk's code does not
work".
(Note the single quote/apostrophe that would normally break
this string
if it was not escaped.
To tell CF not to do this, one uses the
preserveSingleQuotes() function.
The documentation has all the details.

Similar Messages

  • Passing String Which Has Single Quote Row/Value to a Function Returns Double Quoate

    Hi, I'm getting weird thing in resultset. When I pass String which has single quote value in it to a split function , it returns rows with double quote. 
    For example  following string:
    'N gage, Wash 'n Curl,Murray's, Don't-B-Bald
    Returns:
    ''N gage, Wash ''n Curl,Murray''s, Don''t-B-Bald
    Here is the split function:
    CREATE Function [dbo].[fnSplit] (
    @List varchar(8000), 
    @Delimiter char(1)
    Returns @Temp1 Table (
    ItemId int Identity(1, 1) NOT NULL PRIMARY KEY , 
    Item varchar(8000) NULL 
    As 
    Begin 
    Declare @item varchar(4000), 
    @iPos int 
    Set @Delimiter = ISNULL(@Delimiter, ';' ) 
    Set @List = RTrim(LTrim(@List)) 
    -- check for final delimiter 
    If Right( @List, 1 ) <> @Delimiter -- append final delimiter 
    Select @List = @List + @Delimiter -- get position of first element 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    While @iPos > 0 
    Begin 
    -- get item 
    Select @item = LTrim( RTrim( Substring( @List, 1, @iPos -1 ) ) ) 
    If @@ERROR <> 0 Break -- remove item form list 
    Select @List = Substring( @List, @iPos + 1, Len(@List) - @iPos + 1 ) 
    If @@ERROR <> 0 Break -- insert item 
    Insert @Temp1 Values( @item ) If @@ERROR <> 0 Break 
    -- get position pf next item 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    If @@ERROR <> 0 Break 
    End 
    Return 
    End
    FYI: I'm getting @List value from a table and passing it as a string to split function.
    Any help would be appreciated!
    ZK

    fixed the issue by using Replace function like
    Replace(value,'''''','''')
    Big Thanks Patrick Hurst!!!!! :)
    Though I came to another issue which I posted here:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a26469cc-f7f7-4fb1-ac1b-b3e9769c6f3c/split-function-unable-to-parse-string-correctly?forum=transactsql
    ZK

  • SSRS Report Returning Double Quote string from a Single Quote String

    Hi, I'm getting weird thing in resultset from SSRS report when executed. When I pass parameter to a report, which passes String that has single quote value to a split function , it returns rows with double quote. 
    For example  following string:
    'N gage, Wash 'n Curl,Murray's, Don't-B-Bald
    Returns: 
    ''N gage, Wash ''n Curl,Murray''s, Don''t-B-Bald
    through SSRS report.
    Here is the split function Im using in a report.
    CREATE Function [dbo].[fnSplit] (
    @List varchar(8000), 
    @Delimiter char(1)
    Returns @Temp1 Table (
    ItemId int Identity(1, 1) NOT NULL PRIMARY KEY , 
    Item varchar(8000) NULL 
    As 
    Begin 
    Declare @item varchar(4000), 
    @iPos int 
    Set @Delimiter = ISNULL(@Delimiter, ';' ) 
    Set @List = RTrim(LTrim(@List)) 
    -- check for final delimiter 
    If Right( @List, 1 ) <> @Delimiter -- append final delimiter 
    Select @List = @List + @Delimiter -- get position of first element 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    While @iPos > 0 
    Begin 
    -- get item 
    Select @item = LTrim( RTrim( Substring( @List, 1, @iPos -1 ) ) ) 
    If @@ERROR <> 0 Break -- remove item form list 
    Select @List = Substring( @List, @iPos + 1, Len(@List) - @iPos + 1 ) 
    If @@ERROR <> 0 Break -- insert item 
    Insert @Temp1 Values( @item ) If @@ERROR <> 0 Break 
    -- get position pf next item 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    If @@ERROR <> 0 Break 
    End 
    Return 
    End
    FYI: I'm getting @List value from a table and passing it as a string to split function. 
    Any help would be appreciated!
    ZK

    Another user from TSQL forum posted this code which is returning the same resultset but when I execute both codes in SQL server it works and return single quote as expected.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8d5c96f5-c498-4f43-b2fb-284b0e83b205/passing-string-which-has-single-quote-rowvalue-to-a-function-returns-double-quoate?forum=transactsql
    CREATE FUNCTION dbo.splitter(@string VARCHAR(MAX), @delim CHAR(1))
    RETURNS @result TABLE (id INT IDENTITY, value VARCHAR(MAX))
    AS
    BEGIN
    WHILE CHARINDEX(@delim,@string) > 0
    BEGIN
    INSERT INTO @result (value) VALUES (LEFT(@string,CHARINDEX(@delim,@string)-1))
    SET @string = RIGHT(@string,LEN(@string)-CHARINDEX(@delim,@string))
    END
    INSERT INTO @result (value) VALUES (@string)
    RETURN
    END
    GO
    ZK

  • Reading String within the single quotes

    Hi All,
    Can you please let me know, how to read a String within the sinle quote in line.
    I have to read a report into internal table and again from that I need to read a string within the single quote. Please help me in this.
    Thanks in Advance,
    Raghu

    I have the following code:
    REPORT  test.
    DATA:  v_test(05) TYPE c.
    v_test = ‘TTT’.
    I am getting this errror:
    Field “TTT” is unknown.  It is neither kin on e of the specified tables nor defined by a “DATA” statement.
    For some reason, my single quote is not being recognized from my keyboard.  I noticed that my emotion icons are not being displayed either (example:  I type and i do NOT get the smiley face on my end).
    Is there a button that I pressed that caused that?

  • Trouble with inserting a string containing a single quote

    Using php with Oracle
    If I do the following two lines before sending my $Query string through the parse function
    $name = "Dominick's";
    $Query = "INSERT INTO customers (name) values ('$name')";
    it gives me the following error:
    Warning: Ora_Parse failed (ORA-00917: missing comma -- while processing OCI function OPARSE)
    If I try and force the single quote to be surrounded by double quotes and therefore not be confused:
    $name = "Dominick's";
    Query = "INSERT INTO customers (name) values (\"$name\")";
    Trying that yields the following error:
    Warning: Ora_Parse failed (ORA-01741: illegal zero-length identifier -- while processing OCI function OPARSE)
    Help
    Jeff

    If it is possible (and here it is) you should use str_replace instead of ereg_replaceThanks for the reminder about str_replace().
    $Query = "INSERT INTO customers (name) values ('".addSlashes($name)."')";This gives an invalid Oracle SQL statement, which will generally fail with
      ORA-01756: quoted string not properly terminatedFor Oracle, single quotes must be doubled, not escaped with backslash.
    Of the solutions to insert the data, I'd prefer using bind variables
    since no escaping or quote doubling is needed.
    -- CJ

  • String with embedded single quote

    Hi, all. We're trying to pass a string from one procedure to another, which will then do an EXECUTE IMMEDIATE on it. However, there are single quotes withing the string, and they're driving us nuts! This is what the concatenated string should look like when passed to the pw_execDDL procedure:
    insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values ('MEAG', to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
    Here's the concatenation process that doesn't work, and there are functions being called within the string:
    chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (' || '''' || prm_inoc_id || '''' || ', ' || 'to_date(' || '''' || prm_proof1 || ''''||','||'''' ||'DD-MMM-YY'||''''||')' || ', ' || '''' || fw_is_proof_valid(prm_birth_date, prm_proof1) || '''' || ',1);';
    pw_execDDL(chr_sql); /* call the procedure to do the EXECUTE IMMEDIATE */
    Help! We've tried every combination -- using two single quotes together, three, and four, and still no luck. Thanks.

    insert into appimmunization.wsrprfs (inoc_id, proof,
    is_valid,proof_num) values ('MEAG',
    to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
    This statement can be made in a string with the following affectation:
    chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (''MEAG'', to_date(''02-OCT-05'',''DD-MMM-YY''), ''Y'',1)';
    Note please that each single quote in your original string must be specified using two single quotes and that is all. It is more readable and more easy to do it this way.
    Michel.

  • String comparison having single quote

    hi
    i m comparing a string which already have a single quote like this
    var_name=khurram' shehzad
    select * from table where name=' var_name ';
    plz help me how to do it bcoz its creating probelm
    thanks and regards,

    Hi,
    I hope the below example will help you.
    SQL>SELECT 'abc''' FROM DUAL WHERE 'abc''' = 'abc''';
    'ABC
    abc'
    1 row selected.
    SQL>
    Regards

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

  • String values changing when compiling, preverifying and packing apps.

    I have an app that uses commands. The command text values I pick from String array, that contains all the values for various Commands. This is done for making it easier to change languages in the app.
    The problem is that vhen I pack the app, these string-values might be changed. Characters that are bit more exotic.. (like spanish letters with ' or ~ on top of the character on various european characters with dots are converted something else.
    At the moment I just initialize these Strings like
    String text = "Do this";Any ideas how to avoid this conversion..
    P_s

    Thanks, that did the trick. And after little googling around I found this nice table to cover the codes as well.
    http://www.cs.tut.fi/%7Ejkorpela/latin1/1.html
    P_s

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

  • How can i insert values with single quote (')

    How can i insert a values like ABC's ?
    Edited by: LuKKa on Oct 6, 2010 12:48 PM

    LuKKa wrote:
    I want to insert like this :-
    INSERT INTO myTab values ('This is belong's to ABC's ');
    Then how can i do ?In a old style you can do this
    insert into mytab valeus('This is belong''s to ABC''s');

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

  • JSF inputText takes apostrophe (single quote) as end of string

    Hi,
    I run into a problem with JSF when apostrophe(single quote) is in input text:
    <h:inputText id="input1" styleClass="field" size="20" maxlength="20" value="#{bean.property1}" />
    When user inputs string contains apostrophe (single quote), for example "John's task", the bean only gets "John". The text after the apostrophy is gone. It seems that the inputText takes apostrohe as end of the string.
    I also test with escaple sequence, for example, input is "John\' task", the result in bean is still "John"
    input is "John\\\' task", the result in bean is "John
    It doesn't have problem with other special characters, such as "<">", "@" , double quote etc.
    Finally, I fix the problem by replacing apostrohy with "& # 0 3 9".
    I just wonder if anyone has similar prolbem and wehether this is some bug in certain version of JSTL or some configuration issue ( for example, some definittion for end of the string in some config file, etc).
    Your insight is appreciated.
    Thanks

    Without the actual code we can't be of any meaning for you. Create a small reprocudeable test case and post the actual code here. For example:
    JSF<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <f:view>
        <html>
            <head>
                <title>test</title>
            </head>
            <body>
                <h:form>
                    <h:inputText value="#{myBean.value}" />
                    <h:commandButton value="submit" action="#{myBean.action}" />
                    <h:outputText value="#{myBean.value}" />
                </h:form>
            </body>
        </html>
    </f:view>MyBeanpackage mypackage;
    public class MyBean {
        private String value;
        public void action() {
            System.out.println(value);
        public String getValue() {
            return value;
        public void setValue(String value) {
            this.value = value;
    }faces-config:<faces-config>
        <managed-bean>
            <managed-bean-name>myBean</managed-bean-name>
            <managed-bean-class>mypackage.MyBean</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
    </faces-config>Which works fine by the way.

  • How to deal with single quote (') in a field value?

    I can successfully insert value with single quoet using
    Prepared statement with placeholder(?) construct .
    I can also successfuly use value with single quote(') in
    WHERE clause.
    My question is, is there a way to use string with single
    quote if a Statement like:
    String slqString ="INSERT INTO customers (name, address) VALUES ( 'O'Reilly Bob', 'St Mary's Street') ";
    Statement sqlStmt = con.createStatement();
    sqlStmt.executeUpdate(sqlString);
    The last statement will thow an SQLException because due to single quotes
    Any ideas?

    I think the question was regarding the ' in O'Reily. Use ' twice when using the Statement interface, i.e.
    ("O''Reilly Bob", "St Mary''s Street")
    So that's two single quotes, not a double quote, to successfully insert a single quote, if you know what I mean....
    But like you said PreparedStatement does things like this for you.

  • ReplaceAll() single quotes to double quotes

    i've been trying to use the replaceAll() method to change single
    quotes in a document to double quotes. All my attempts have
    failed.
    Thanks in advance,
    Enaknonnel

    Sorry, I was terse in my first post, but since you are just replacing one char
    with another, using replaceAll is overkill -- it is meant to take a regular expression
    search string. So keep it simple and use replace. I think you may have
    chosen replaceAll because of that reassuring "All" in its name, but do check
    the API: method replace replaces all occurrences.
    One more thing: posting something like "All my attempts have failed" is itself
    a failure. It tells us nothing concrete. A better post would have included
    a short example program that was your best attempt.

Maybe you are looking for

  • Connect to Remote Oracle Database

    I am unsuccessfully trying to connect to remote Oracle database using OleDB/ODBC/Oracle Client. Do I have to install Oracle Client in order to use those drivers and which version? I would really appreciate any help. THANK YOU!

  • Role OF ABAP in ELM

    Hi, Can somebody please guide me regarding role of ABAP in ELM. I know that ELM is used in CRM for uploading Business part. but how exactly ABAP plays a role in this. Please guide em through... If you can send me some <<removed by moderator>>  it wou

  • No audio or video files play after screensaver

    After screensaver is on for some time, when returning to desktop, no audio or video files work, for web videos there is no audio, only video and for local files, there is no playback this is the same with any application (iTunes, quicktime, Mplayer,

  • Puzzling requirement --- SOS

    Hi experts , I need ur guidance i have two tables S1 and S2.Now we have three columns in it api_number well name and section.Remember the apinumber for both the column is one and same but some well names may be different . I have written a stored pro

  • SQL Server 2008r2 issue for w8.1

    Hi, I am getting sql server 2008r2 compatibility issue for w8.1 whenever I try to installed it.Please check the attached screen shoot given bellow