Preserving Single Quotes
I'm using the following code to produce a list of zipcodes
for a radius search:
<cfset Caller.passedreturneddata =
Caller.passedreturneddata & "'#mystruct.zipcode[x]#' or ">
The result is like '12345' or '23456' or '34567'.
CF is turning the single quotes into double quotes and giving
SQL error below. How can I preserve the single quotes?
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error
(missing operator) in query expression 'fee = No And
Category = Horoscope And Subcategory = Horoscope3 And ZipCode =
''80212'' or
''80212'' or
''80212'' or
''80034'' or
''80214'' or
''80214'' or
''80214'' or
''80214'' or
''80211'' or
''80033'' or
''80033'' or
''80033'' or
''80001'' or
''80002'' or'.
The error occurred in eventsradius.cfm: line 8
6 : And Category = #form.category#
7 : And Subcategory = #form.subcategory#
8 : And ZipCode = #form.zipcode#
9 : Order by date, time
10 : </cfquery>
SQL Select * From Calendar2 Where fee = No And Category =
Horoscope And Subcategory = Horoscope3 And ZipCode = ''80212'' or
''80212'' or ''80212'' or ''80034'' or ''80214'' or ''80214'' or
''80214'' or ''80214'' or ''80211'' or ''80033'' or ''80033'' or
''80033'' or ''80001'' or ''80002'' or ''80002'' or ''80002'' or
''80204'' or ''80295'' or ''80257'' or ''80266'' or ''80266'' or
''80248'' or ''80217'' or ''80265'' or ''80292'' or ''80215'' or
''80215'' or ''80215'' or ''80255'' or Order by date, time
DATASOURCE normmy_denver
VENDORERRORCODE -3100
SQLSTATE 42000
Thanks!
David
That worked for the single quotes, but I've never seen this
error before. Not finding anything in Google either.
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] In operator
without () in query expression 'fee = No And Category =
Horoscope And Subcategory = Horoscope3 And ZipCode IN
Select * From Calendar2 Where fee = No And Category =
Horoscope And Subcategory = Horoscope3 And ZipCode IN ''80212','
80212',' 80212',' 80034',' 80214',' 80214',' 80214',' 80214','
80211',' 80033',' 80033',' 80033',' 80001',' 80002',' 80002','
80002',' 80204',' 80295',' 80257',' 80266',' 80266',' 80248','
80217',' 80265',' 80292',' 80215',' 80215',' 80215',' 80255',' ''
Order by date, time
Similar Messages
-
Preserve single quote in text data.
I have text data that is read into a BurrefedReader, some text contain single quoutes such as Ray's. When I retieve the data instead of seeing the single quote I see a square box replacing the single quote. What can I do in java to preserve the single quote?
Thanks.Many thanks....here is my original code:
public static String ClobToString(Clob cl) throws IOException, SQLException
if (cl == null)
return "";
StringBuffer strOut = new StringBuffer();
String aux;
String aux2;
BufferedReader br = new BufferedReader(cl.getCharacterStream());
String ls =System.getProperty("line.separator");
while ((aux=br.readLine())!=null)
strOut.append(aux+ls);
return strOut.toString();
Here is the code with the encoding convertion:
public static String ClobToString(Clob cl) throws IOException, SQLException
if (cl == null)
return "";
StringBuffer strOut = new StringBuffer();
String aux;
String aux2;
BufferedReader br = new BufferedReader(cl.getCharacterStream());
String ls =System.getProperty("line.separator");
while ((aux=br.readLine())!=null)
strOut.append(aux+ls);
StringInputStream st = new StringInputStream(strOut.toString());
InputStreamReader inStreamReader=new InputStreamReader(st,"UTF-8");
BufferedReader bufReader=new BufferedReader(inStreamReader);
StringBuffer strOut2 = new StringBuffer();
while ((aux2=bufReader.readLine())!=null)
strOut2.append(aux2+ls);
return strOut2.toString();
I do thank you again for any help. -
Any way to generate a single quote (') with XSLT?
Hi:
I guess this is really an XSLT question. I'm using the Transform() method of an XMLType variable to apply a style sheet. The XML in the variable is just something simple like
<TBL>
<LAST_NAME>LIKE|JONES</LAST_NAME>
<FIRST_NAME>=|MARY</FIRST_NAME>
<AGE>=|50</AGE>
</TBL>
I am trying to get a stylesheet to transform something like the above into SQL such as
Select * from foo where LAST_NAME like 'JONES'
and FIRST_NAME ='MARY'
and AGE = 50But to do this, I need to generate the single quotes around the search terms and I can't get anything but LAST_NAME LIKE 'JONES'. Is there a way to do this? For now I am generating a ~ and replacing ~ for ' throughout the generated SQL text but that's a pretty sorry solution.
I thought that something like <xsl:text disable-output-escaping="yes">&</xsl:text> was going to work but then found out it has been deprecated. I was thinking character-map might work but that's an XSLT 2.0 thing and apparently 10g is on XSLT 1.0? In any case, it had no idea what I was trying to do with a character map.
So, am I overlooking an obvious way to get my stylesheet to insert apostrophes?
Thanks.It's 10.2.0.4.
Here's the procedure that accepts the XML/XSL clobs and tries to produce a SQL statement.
PROCEDURE GetSQLQueryFromXML(XMLClob in CLOB, XSLStylesheet in CLOB,
SQLQuery out CLOB, status out integer) IS
-- Define the local variables
xmldata XMLType; -- The XMLType format of the XML to transform
xsldata XMLType; -- The XMLType format of the stylesheet to apply
sqlQuery_XMLType XMLType; -- The XMLType format of the SQL query.
v_SQLQuery Clob; -- Holds XML Clob before translating ~ to '
BEGIN
status := -1; -- Initially unsuccessful
-- Get the XML document using the getXML() function defined in the database.
-- Since XMLType.transform() method takes XML data as XMLType instance,
-- use the XMLType.createXML method to convert the XML content received
-- as CLOB into an XMLType instance.
xmldata := XMLType.createXML(XMLClob);
-- Get the XSL Stylesheet using the getXSL() function defined in the database.
-- Since XMLType.transform() method takes an XSL stylesheet as XMLType instance,
-- use the XMLType.createXML method to convert the XSL content received as CLOB
-- into an XMLType instance.
xsldata := XMLType.createXML(XSLStylesheet);
-- Use the XMLtype.transform() function to get the transformed XML instance.
-- This function applies the stylesheet to the XML document and returns a transformed
-- XML instance.
sqlQuery_XMLType := xmldata.transform(xsldata);
-- Return the transformed XML instance as a CLOB value.
v_SQLQuery := sqlQuery_XMLType.getClobVal();
-- Change tildas to apostrophes. Currently unable to get an XSLT transformation
-- to insert single quotes, so we're inserting ~ instead. Now we need to
-- translate all ~s to 's in our query.
SQLQuery := translate(to_char(v_SQLQuery),'~','''');
status := 1; -- Everything went fine to get here
EXCEPTION
WHEN OTHERS THEN
raise_application_error
(-20102, 'Exception occurred in GetSQLQueryFromXML :'||SQLERRM);
END GetSQLQueryFromXML;The XML it works off of is
someXML CLOB :=
to_clob('<?xml version="1.0" encoding="windows-1252" ?>
<variable table_name="SOME_PERSON_TABLE" query_type="PERSON">
<item>
<fieldName><![CDATA[PERSON_KEY]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[Integer]]></fieldType>
<value><![CDATA[123456789]]></value>
</item>
<item>
<fieldName><![CDATA[LAST_NAME]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value><![CDATA[DOE]]></value>
</item>
<item>
<fieldName><![CDATA[FIRST_NAME]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value><![CDATA[JOHN]]></value>
</item>
<item>
<fieldName><![CDATA[MIDDLE_NAME]]></fieldName>
<criteria><![CDATA[-]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value />
</item>
<item>
<fieldName><![CDATA[SUFFIX]]></fieldName>
<criteria><![CDATA[-]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value />
</item>
</variable>');And the corresponding XSLT that should translate it is:
myStylesheet CLOB :=
to_clob('<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <xsl:preserve-space elements="list-of-element-names"/> -->
<!-- We just want the SQL text output. No XML declaration etc. -->
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<!-- Apostrophes will be made tildas and the PL/SQL will translate those to -->
<!-- apostrophes for the final SQL string. -->
<xsl:variable name="apos">~</xsl:variable>
<xsl:template match="/">
select * from
<xsl:value-of select="variable/@table_name"/>
where 1=1
<xsl:for-each select="variable/child::node()">
<xsl:choose>
<!-- if the value node is not null... -->
<xsl:when test="./value/text()[normalize-space(.)]">
<!-- There is another predicate. Add the AND term and the predicate -->
AND <xsl:value-of select="./fieldName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="./criteria"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="string(./fieldType)=''String''">
<xsl:copy-of select="$apos" />
<xsl:value-of select="./value"/>
<xsl:copy-of select="$apos" />
</xsl:when>
<xsl:when test="string(./fieldType)=''Clob''">
<xsl:copy-of select="$apos" />
<xsl:value-of select="./value"/>
<xsl:copy-of select="$apos" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>');Basically if the VALUE element has a value then the fieldType is checked. If fieldType is String or Clob then we'll need the apostrophes. For now I'm putting in tildas and changing them later. -
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 -
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. -
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!
ZKAnother 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 -
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 -
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.PAs 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,
ArchanaAs 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 escape a single quote in a find mode view
Hello,
I'm working with JDeveloper 10g.
I've defined a view that is used in "find mode" in a JSP.
When a value with a single quote is inserted in a field of the search form, an exception is thrown:
JBO-27122: SQL error during statement preparation.
ORA-00907: missing right parenthesis.
The problem is that the "single quote" is not being escaped:
WHERE STREET LIKE 'ABAT ESCARRE, DE L'A'
How could I force the view to escape the "single quote"?
ThanksArrest the single quote by calling a javascript method.
This might help you
Re: af:clientListener javascript function call question
http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_clientListener.html
Edited by: Srinidhi on Mar 23, 2011 3:46 PM -
Dynamic SQL and Data with Single Quotes in it.
Hi There,
I have a problem in that I am using dynamic SQL and it happens that one of the columns does contain single quotes (') in it as part of the data. This causes the resultant dynamic SQL to get confused as the single quote that is part of the data is taken to mean end of sting, when in fact its part of the data. This leaves out a dangling single quote that was meant to enclose the string. Here is my dynamic SQL and the result of the parsed SQL that I have captured:
****Dynamic SQL*****
l_sql:='select NOTE_TEMPLATE_ID '||
'FROM TMP_NOTE_TEMPLATE_VALUES '||
'where TRIM(LEGACY_NOTE_CODE)='''||trim(fp_note_code)||''' '||
'and TRIM(DISPLAY_VALUE)='''||trim(fp_note_text)||''' ';
execute immediate l_sql INTO l_note_template_id;
Because the column DISPLAY_VALUE contains data with single quotes, the resultant SQL is:
******PARSED SQL************
select NOTE_TEMPLATE_ID
FROM TMP_NOTE_TEMPLATE_VALUES
where TRIM(LEGACY_NOTE_CODE)='INQ' and TRIM(DISPLAY_VALUE)='Cont'd'
And the problem lies with the single quote between teh characters t and d in the data field for DISPLAY_ITEM. How can I handle this?
Many thanks,I have been reliably informed that if one doesn't enclose char/varchar2 data items in quotes, the right indices may not be usedI am into oracle for past 4 years and for the first time i am hearing this.
Your reliable source is just wrong. Bind variables are variables that store your value and which are used in SQL. They are the proper way to use values in your SQL. By default all variables in PL/SQL is bind variable.
When you can do some thing in just straight SQL just do it. Dynamic SQL does not make any sense to me here.
Thanks,
Karthick. -
Html output genreated by the xsl should have a single quote
hi
i am trying to convert the xml into html .
For one particular field i need to invoke a javscript method on
click. a value has to be passed to this javascript method. for
this i need a single quote or a double quote to come in the
output.
<a href ="javascript:loadPage('Student')"/> is what my output
should look like but i ma getting it as
<a href ="javascript:loadPage('Student&apos)"/> which is
invalid.
i am constructing the string like
<xsl:variable name="pageName" select="'Student'"/>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('javascript:loadPage
(',',$pageName,',')')"/>
</xsl:attribute>
Also i tried declaring a variable and using it instead of '
<xsl:varaible name="squote">'</xsl:variable>
how to overcome this problem ?This was a bug in 9.0.1
It's fixed in 9.0.2. For example, using the following slight
modification of your example with 9.0.2D Beta, I get the right
answer:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="pageName" select="'Employee'"/>
<xsl:variable name="apos">'</xsl:variable>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('javascript:loadPage(',
$apos,
$pageName,
$apos,
)"/>
</xsl:attribute>
foo
</a>
</xsl:template>
</xsl:stylesheet>Notice that I've created a variable named apos and use
that in the concat() instead of directly using the character
reference. This makes things clearer, I think, and easier to
look at visually. -
I have a custom function in which I want to parse out any single quotes as they are causing problems further down in our process. Actually what I want the function to do is to find the first single quote, if it exists, then strip the single quote and the rest of the text out. Her is the function I am trying to use:
ifthenelse(
index($InputText , '\'', 0) > 0,
substr( $InputText, 0, index( $InputText , '\'', 0) -1),
$InputText
$InputText is a varchar datatype and contains a sting which may or may not contain an single quote.
How does one look for a single quote in either a function like this or in a replace function?
Thanks,
RyanThe error in the editor is that is not expecting the less than sign, but rather expecting a right parenthasis ) or a comma.
Error MSG:
[Function:CF_TruncateApostrophe]
(Ln 3) : Syntax error : near <>> found <>> expecting <')', ','>
I will try to encase the whole index statement for the test in parenthesis and see what happens.
Ryan -
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. -
Query with Apostrophe (single quote)
Hi all,
I have noticed that when you enter a search string with an apostrophe (eg. Tito's Station) in a textbox on a form linked to a table and hit the Query button, it generates an sql error. I think this is cos u cannot have an apostrophe (single quote) in the search string in a "where" clause.
I am using Portal version 3.0.6.6.5 on an 8.1.7 database.
I have logged a tar (1744105.999) for this but it is said to be a bug (1759202). I wish to enquire whether any of you have had this problem with a later version or at which version leve this bug has been fixed.
Does any1 know how to limit the text typed into a texbox, so that it wont accept certain characters (eg. the apostrophe key) ??
ThanksHi Rene'
Thanks for your help! This will definitely help me alot! I am a little baffled with your code for delimiting the single quote. I tried it and it doesnt work.
Thanks very much for the response
Naseem
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rene' Castle ([email protected]):
This is still an issue in 3.0.8.9.8. You can use a Javascript validation routine to disallow special characters.
If you want to check to see that they only enter certain things you can do:
var s = theElement.value;
var filter=/^[a-zA-Z]{1,}$/;
if (s.length == 0 ) return true;
if (filter.test(s))
return true;
else
alert(" Please input a valid character" );
theElement.focus();
theElement.select();
return false;
The above code would only allow one or more alphabetic characters. You could make it [a-zA-Z0-9] to allow alphanumeric characters. You could also allow anything but specific characters by doing the following:
var s = theElement.value;
var filter=/[^']*/;
if (s.length == 0 ) return true;
if (filter.test(s))
alert(" Please input a string without a single quote (') in it" );
theElement.focus();
theElement.select();
return false;
else
return true;
Hope this gets you started.
Rene'<HR></BLOCKQUOTE>
null
Maybe you are looking for
-
Authentication between Single Sign-On and Web based applications
Hi everyone, I need to create a way in Portal 10g (10.1.2.0.2) that allow me to do the following: Once the user is logged on Portal (against Single Sign-On - SSO) he doesn't need to retype his username/password when he access a web based application
-
Facing error when trying to read message from MQ through B2B
Hi, I'm trying to read the messages from MQ through B2B. I have created a listening channel in B2B console. Also place the required jar files in the Domain_Dir/lib folder.For your reference the jar files are given below, a. com.ibm.mqjms.jar b. dhbco
-
Hi, when adding a new item in SAP GUI, we get an option for the connection type------ Custom application server Group/Server selection On selection the Group/Server selection we need to add the System ID, Message server, SAP Router and Group/Server.
-
the query that i wish to write is as follows : i want to parameterise the column name , table name, value and then retrieve the no of rows returned for that column, table and that value. Example Query : select ename from emp where empno = 1; here the
-
Order cannot be cast to com.tangosol.util.MapEvent
This code is causing an exception. How should I be writing this filter? I want to listen for events when the status changes for one specific Order object. That Order has an integer key property which is the same integer key value used to store it in