Single Quote in Parameter values...!
Hi there,
I am using oracle oracle disco. 10g
In my report there are 2 parameters. First being the customer name and another being the transaction reference. Transaction reference parameter is based on the customer name(s) selected.
The customer data contains a single quote [e.g. ABC's]. Thus, when the user selects the customer name [with a single quote] and tries to select the transaction reference - discoverer viewer returns an error message - 'Invalid Value'
This does not happens in discoverer plus.
Imp: We can not change the data - otherwise I would have remove the single quote from the customer name as part of my query.
any ideas..!
Any help would be really appreciated.
Best Regards,
Manish
Hi Yogini,
Thanks for your reply.
When the customer name is selected, discoverer reports automatically enclose the customer names in single quotes. like 'ABC LTD', 'ABC's INC',
I know how to change this single quote format. Also we don't want user to change the parameter selection criteria once selected.
Also related to double quotes isn't it doubles are treated as column names in the SQL query and can not be used for any other purpose.
Apologies, I haven't tried this but I think it will not work. Have you tried this with discoverer viewer.
As mentioned intrusting things is when a customer name with single quote is selected in discoverer Plus it automatically formats the filter criteria to look like ['ABC LTD', 'ABC''s INC'] but this thing doesn't happen in viewer.
I think this is a bug in discoverer viewer and think there must be some patch available to correct this problem.
Sorry, don't have a solution yet but will certainly update the thread once I get the solution.
Also please keep looking for a solution and let me know as well.
Thanks a lot in advance.
Best Regards,
Manish
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 handle XML string with Single Quotes as a parameter to SP dynamically?
Hi,
I would like to know if there is a way to handle the Single Quotes in XML value when it is passed to Stored Procedure?
I should be able to handle it without adding another Single Quote to it.
Thanks,
Chandra ShekarHi Chandra,
Your requirement is not precise. Based on my understanding and guessing, are you metioning something like the below sample?
/*If the xml is generated you have no need to escape the singe quote(')*/
DECLARE @xmlTbl TABLE (ID INT,name VARCHAR(99));
INSERT INTO @xmlTbl VALUES(1,'Eric''s')
INSERT INTO @xmlTbl VALUES(2,'Zhang''s')
DECLARE @xmlDoc1 XML
SELECT @xmlDoc1
FROM @xmlTbl FOR XML PATH('PERSON'),ROOT('PERSONS')
EXEC yourProcedure @xmlDoc1
/*If your copy and paste the xml, you have to escape the single quote(') with 2s('')*/
DECLARE @xmlDoc2 XML
SET @xmlDoc2 = '<PERSONS>
<PERSON>
<ID>1</ID>
<name>Eric''s</name>
</PERSON>
<PERSON>
<ID>2</ID>
<name>Zhang''s</name>
</PERSON>
</PERSONS>'
EXEC yourProcedure @xmlDoc2
If that is not regarding your requirement, please elaborate with more details.
Eric Zhang
TechNet Community Support -
Unable to pass parameters in Report Bulder due to single quotes
Hello,
I have a problem with parameters in Report Bulder.
This is the query:
where task.closed_at between (@Per)
Then I need have to pass following value to @Per : DATEADD(month, -5, getdate()) and getdate()
to get following:
where task.closed_at between DATEADD(month, -5, getdate()) and getdate()
But I suppose Report Builder put the values to quotes and WHERE looks like:
where task.closed_at between 'DATEADD(month, -5, getdate()) and getdate()'
and Builder returns syntax error.
How can I solve this issue and avoid these single quotes surrounding the value?
Thank you.Hi zotchy07,
According to your description, you have a report created use Report Builder. You want to select data according to the search condition: task.closed_at within 5, 12 or 24 months.
Please refer to the following steps to achieve your goal:
1. In design surface, right-click Parameter and click Add Parameter.
2. In Report Parameter Properties dialog box, type the name and prompt, set Data Type to Integer.
3. Click Available Values in left pane, check Specify Values.
4. Click Add, set Label to 5, Value to -5.
5. Repeat step4 above, set Label to 12, Value to -12, then Label to 24, Value to -24, then click OK.
6. Right-click the dataset you used to retrieve data and open Dataset Properties dialog box.
7. Click Filters in left pane, click Add.
8. From Expression drop down list, select closed_at and set Operator to between.
9. Click the first (fx) button and type the expression like below:
=DateAdd("m", Parameters!param_name.Value,Today())
10. Click the second (fx) button and type the expression like below, then click OK.
=Today()
In this way, when we preview the report, there are 3 selects in the parameter drop down list: 5, 12, 24. If we select 5 and click View Report, the data within 5 months will be displayed.
The following screenshots are for your reference:
If you have any questions, please feel free to let me know.
Best Regards,
Wendy Fu -
Single quote ' in output difficulty
I'm trying to output a single quote, then a value, but I'm having trouble. Any solutions?
I've tried using '', ''', '(...)'.
tabFIELD = 'tab-field'.
varVALUE = 'CCC'.
CONCATENATE cond
tabfield
'EQ'
<b>''varVALUE''</b>
INTO cond SEPARATED BY SPACE.
when using ''varVALUE'' my output is just CCC.
when using '''varVALUE''' my output is 'varVALUE'.
when using 'varVALUE' my output is just CCC.
when I try '''(varVALUE)''' my output is '(varVALUE)'.
I want 'CCC'.
Anybody know the solution? please help.
N LTo use a single quote you need to double it. Try:
'''varVALUE'''
Since varValue is a variable, try:
'''' varvalue ''''
in your concatentation.
If you want no spacing, then you might need to put the last bit of code above in its own concatentation without seperating by space, then include that in final concatenation.
Let us know how it goes.
Message was edited by: Charles Folwell
Message was edited by: Charles Folwell -
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 AMquote:
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. -
Report parameter field value has a single quote. need to escape before pass
Report has a parameter whose value might have a single quote in it. If I pass that value directly into the SQL Command... like
where ... user_name = {?parm_user_name}...
which would translate to
user_name='O'Donnel Honda'
I am getting an error... so would like to convert this parameter value into 'O''Donnel Honda' before passing into the query.
I created a formula called parse_user_name with following:
Replace ({?parm_user_name}, "'", "''")
And used in the query like
where ... user_name = {@parse_user_name}...
I am getting an error like invalid SQL92 character...I think you should use the condition like this
where ... user_name = '{?parm_user_name}'
keep the parameter in single quote at the command level itself.
Now use the same formula like
replace({?Parameter},"'","''")
This works only if the parameter is a single value parameter but not multi value parameter.
Regards,
Raghavendra -
Data model: single quote in default parameter value
Hello,
when I assign a default value to a parameter in my Data model, which includes a single quote (i.e. "It's a default value"), then the single quote is escaped with a backslash (i.e. "It\'s a default value") when I open the report associated with the data model. How can I get rid of the escape character when opening a report?
Regards,
JureHi Yogini,
Thanks for your reply.
When the customer name is selected, discoverer reports automatically enclose the customer names in single quotes. like 'ABC LTD', 'ABC's INC',
I know how to change this single quote format. Also we don't want user to change the parameter selection criteria once selected.
Also related to double quotes isn't it doubles are treated as column names in the SQL query and can not be used for any other purpose.
Apologies, I haven't tried this but I think it will not work. Have you tried this with discoverer viewer.
As mentioned intrusting things is when a customer name with single quote is selected in discoverer Plus it automatically formats the filter criteria to look like ['ABC LTD', 'ABC''s INC'] but this thing doesn't happen in viewer.
I think this is a bug in discoverer viewer and think there must be some patch available to correct this problem.
Sorry, don't have a solution yet but will certainly update the thread once I get the solution.
Also please keep looking for a solution and let me know as well.
Thanks a lot in advance.
Best Regards,
Manish -
RWRUN60: Problem with parameter value containing space between single quote
Hi All
I'm using RWRUN60 to generate my report by following way:
C:\orant\BIN\RWRUN60.EXE userid=DBUser/dbpasswor@db BACKGROUND="NO" BATCH="YES" DESFORMAT="pdf" DESNAME="C:\report.pdf" DESTYPE="FILE" ORIENTATION="LANDSCAPE" PARAMFORM="NO" P_REPORTID="2431" P_REPORTNAME="Report Name" report="C:\report.rdf" P_WHERE="StartDate>=to_date('2011-07-14 10-37-00','YYYY-MM-DD HH24-MI-SS')"
When I tried to run given command above nothing was executed executed and any log didnt created.
I found out that problem occurs when text between two single quotes contains spaces. In my case it is a parameter P_WHERE. I need to keep such format because it is part of report query.
When I removed last parameter from command RWRUN60 successfully genereate pdf document.
Further I added new test parameter P_TEST(it is ignored by rdf) in the end of command line following:
P_TEST="test '11'" - rwrun60 generates report
P_TEST="test '1 1'" - rwrun60 doesn't; generate report
Can somebody help how to resolve given problem. Is it parsing bug or what else?Spaces on command lines a very often a bad idea. Get rid of them by changing the command, e.g.:
to_date('2011-07-14:10-37-00','YYYY-MM-DD:HH24-MI-SS') -
SSAS SSRS Report Action on Cell Value w/ Embedded Single Quote Not Executing
I have configured an SSAS 2008 R2 cube SSRS ReportAction. I'm having problems when the member value for a cell has an embedded single quote, e.g. abc's. The action displays on the context menu appropriately, but when I click on the action, nothing happens.
For member values that do not have the single quote, the action works as designed. I've added a calculated ember to escape the embedded single quote by adding another single quote, e.g. abc''s, with no luck. Is there a resolution or workaround for this?Hi Mdccuber,
According to your description, you create a reporting action in you cube, and it works fine except the members that have embedded single quote, right? In your scenario, it seems that you pass this value to the report as the parameter.
In SQL Server Analysis Services (SSAS), when pass values to a report, multi-select parameters have to be placed into IN statement and SQL Server Reporting Services (SSRS) will do single-quote wrapping for string values automatically. In this case, the original
value that have embedded single quote will be damaged. So this action not work. You can submit a feedback at
http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product.
Regards,
Charlie Liao
TechNet Community Support -
Lexical parameter and single quotes
I am using perl to build the lexical parameter that is being passed to the report builder. The perl builds an "in" statement for the where clause. In the data the users select some of the values may contain a single quote. I have used a perl script to replace the internal single quote with two single quotes.
Example:
selected values: eeee'ss, ffff'22ww
final string passed: "in ('eeee''ss', 'ffff''22ww')"
I am getting any error message indicating quoted string not properly terminated. Any ideas?
ThanksI have actually found that if the single quote is embedded in the string I can get it to work, however, if the single quote is at the end of the string I am still getting the error message.
To get it to work with the single quote in the string I actually had to create the string with 3 single quotes in place of the embedded one single quote.
Thanks for the suggestion. I will check it out. -
How to copy item value that contain a single quote(')?
Hi,
I have one "Copy" button in a APEX form. When user clicks it, it simply copy the item's values from the form to a new form by using APEX provided function behind the button- "Set these item values with these values". It is simple and works fine in normal cases. However, see, we have a text field called "Product Details", user types in for example "Oracle's new vision". When I click COPY button, APEX try to copy the text in "Product Details" field from this form to a new form but it returns error because of that single quote. Is there any way I can do something to replace that single quote with two single quote like we usually do in PL/SQL in the place "Set these item values with these values" of APEX button? I tried REPLACE(#P66_PRODUCT_DETAILS#., '''', '''''') but not work. I saw someone in the forum meantioned that to use something like "/#P66_PRODUCT_DETAILS#/" to get around. Any one with success?Thanks. I think it should work this way. However, our form has about 20 ~30 text fields, I have to create 20~30 hiddle fields to handle the problem because I never know which field could contain a single quote. Ideally, a new version of APEX should have the functionality to deal with the problem when using "set values with those values" method. At least, it should provide some kind of interaction for user to get away from single quote or comma or column etc.
What I did is to get out of APEX native function and to create a new records in background by PL/SQL using record id that passed in from APEX form. It works perfectly. Although, user can only edit the record after it is created, not as user friendly as "Copy first-look at it-edit it-then create it" I originally planed.
Thanks for your help, -
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
ThanksYou'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). -
Update with a Single Quote value
how do i update a field containing a sigle quote in a record ?
e.g :
i have a table s_order_item_xa
filed: attr_name
old value: Noofndk
new value: Noofn's
how can i update above field value? i am using row_id in where condition to identify rows which i want to update.Hi,
Is the question "How can I include a single-quote character in a string literal?", then the answer is to use 2 of them, like this:
UPDATE books
SET dewey_num = '291''.4'
WHERE dewey_num = '291.4'
;In Oracle 10 (and up) you can also use Q-notation. For example:
UPDATE books
SET dewey_num = Q'[291'.4]'
WHERE dewey_num = '291.4'
;Edited by: Frank Kulash on Sep 14, 2009 9:51 AM -
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!
ZKfixed 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
Maybe you are looking for
-
i recently upgraded iPhones and so did my mum so when i was setting them up i linked the icloud between the two and since then my phone will only keep her contacts even if i restore my phone back to my old phones settings. when i have restored to my
-
Is it possible to receive answers in a completed form like a pdf rather than a database?
This may be a rather odd question, but a client would need to receive answers in a format that can be saved as a record. For example if the user were to fill in the form on paper there would be a hard copy of the questions and their answers. Would th
-
[SOLVED] Conky 100% transparent bg with Compiz
Enabling the Compiz Wallpaper (diffrent wallpaper at different desktop) with disabled nautilus/xfdesktop to draw on it.. How to make conky seems not to lose the transparency? Last edited by rhoit (2013-01-18 16:36:04)
-
Reg: URL For c Projects & C Folders
Hi Experts I'm new to c projects. I'm a PS consultant. I read the course of PLM 510. I would like to practice c projects in IDES. pl let me know which URL i can assign in configuration. other wise how to create URL and and what are all the next steps
-
Syncing Aperture Photos with iPhoto
I recently noticed that not all of the photos in an Aperture "smart album" were syncing with iPhoto. Out of about 400 photos, only 15 were syncing. I think I found out why. It seems that if I have selected "only show recent projects" in the top of th