Single quote in basic lexer preference
Hi Gurus,
Using basic_lexer preference I wanted to consider columns having single quotes *'* also as white space. Please help me to achieve it.
Original Code
ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+&');
I tried using q operator
SQL> begin
ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|\'-_+&q'');\
end; 2 3 4
5 /
Enter value for q:
I also tried
SQL>
SQL> begin
ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+&\'');
end; 2 3 4
5 /
ERROR:
ORA-01756: quoted string not properly terminated
I tried this but it is not indexing as intended.
SQL> begin
ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+&'''); --translating special characters as white space using lexer
end; 2 3 4
5 /
PL/SQL procedure successfully completedplease help me here.
Thanks a lot Barabara for quick reply.
Let me paste my code here.
create table test_sh4 (text1 clob,text2 clob,text3 clob);
insert into test_sh4 values ('ORACLE''s','It isn''t Oracle''s fault.','y');
begin
ctx_ddl.create_preference ('test_mcd', 'multi_column_datastore'); -- utilizing the same index for multiple columns
ctx_ddl.set_attribute
('test_mcd',
'columns',
'replace (text1, '' '', '''') nd1, -- virtual column to eliminate white spaces in text1 column
text1 text1,
replace (text2, '' '', '''') nd2, -- virtual column to eliminate white spaces in text2 column
text2 text2');
ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+&'''); --translating special characters as white space using lexer
ctx_ddl.create_section_group ('test_sg', 'basic_section_group'); -- creating section group to search within sections.
ctx_ddl.add_field_section ('test_sg', 'text1', 'text1', true);
ctx_ddl.add_field_section ('test_sg', 'nd1', 'nd1', true);
ctx_ddl.add_field_section ('test_sg', 'text2', 'text2', true);
ctx_ddl.add_field_section ('test_sg', 'nd2', 'nd2', true);
ctx_ddl.create_preference('SUBSTRING_PREF', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('SUBSTRING_PREF','SUBSTRING_INDEX','TRUE');
ctx_ddl.set_attribute('SUBSTRING_PREF','PREFIX_INDEX','TRUE');
ctx_ddl.set_attribute('SUBSTRING_PREF','PREFIX_MIN_LENGTH', '3');
ctx_ddl.set_attribute('SUBSTRING_PREF','PREFIX_MAX_LENGTH', '8');
ctx_ddl.create_preference('textstore', 'BASIC_STORAGE');
ctx_ddl.set_attribute('textstore', 'I_TABLE_CLAUSE','tablespace TEST_INDEX storage (initial 64K)');
ctx_ddl.set_attribute('textstore', 'K_TABLE_CLAUSE','tablespace TEST_INDEX storage (initial 64K)');
ctx_ddl.set_attribute('textstore', 'R_TABLE_CLAUSE','tablespace TEST_INDEX storage (initial 64K)');
ctx_ddl.set_attribute('textstore', 'N_TABLE_CLAUSE','tablespace TEST_INDEX storage (initial 64K)');
ctx_ddl.set_attribute('textstore', 'I_INDEX_CLAUSE','tablespace TEST_INDEX storage (initial 64K)');
ctx_ddl.set_attribute('textstore', 'P_TABLE_CLAUSE','tablespace TEST_INDEX storage (initial 64K)');
end;
SQL> create index IX_test_sh4 on test_sh4 (text3)
2 indextype is ctxsys.context
3 parameters
4 ('datastore test_mcd
5 lexer test_lex1
6 section group test_sg
7 wordlist SUBSTRING_PREF MEMORY 50M
8 SYNC ( ON COMMIT)
9 storage textstore'
10 );
SQL> select count(*) from (
SELECT SCORE(1) score,t.* FROM test_sh4 t
WHERE CONTAINS (text3, 'ORACLE S' ,1) > 1
order by score desc
) 2 3 4 5
6 /
COUNT(*)
1
I was thinking that combination of lexer preference and virtual column nd1 when indexed will take care of following part. But it is not
SQL> select count(*) from (
SELECT SCORE(1) score,t.* FROM test_sh4 t
WHERE CONTAINS (text3, 'ORACLES' ,1) > 1
order by score desc
) 2 3 4 5
6 /
COUNT(*)
0
I had to correct the code to
ctx_ddl.set_attribute
('test_mcd',
'columns',
'regexp_replace(text1,''[[:punct:]*|[[:space:]*]'') nd1,
text1 text1,
regexp_replace(text2,''[[:punct:]*|[[:space:]*]'') nd2,
text2 text2');
Now it is returning rows as expected.The requirement was to consider any special characters as white spaces, Can we do that in Lexer preference as the logic we are performing iin virtual columns nd1 and nd2.
Similar Messages
-
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. -
Embedded Single Quote in SQL Column truncates Java String
I have a jsp web page that queries a database to see what day a user is registered for and then produces an URL for the user to click on. My problem is that the URL being processed stops when an embedded single quote is encountered.
Here is the database side:
Database side:
Create Table registration
(reg_id int not null,
name varchar2(45) not null,
day_nb int not null);
Insert into registration
(reg_id, name, day_nb)
values (1043,'Johnny''s Diner', 1);
Select name, day_nb from registration
where reg_id = 1043;
name, day_nb
Johnny's Diner 1
Snippet of relevant java code: (JSP page)
<%
int day_nb = rs.getInt("day_nb");
String particpant_name = rs.getString("name");
System.out.println("registration.jsp: particpant_name = " + particpant_name);
%>
<td width="84%">
<a
href='<%=response.encodeURL("registrationHandler.jsp?"particpant_name="+ particpant_name + "&day_nb="+ day_nb)%>'><%=particpant_name%>
</a>
</td>
{code}
The following is printed to System.Out:
registration.jsp: particpant_name = Johnny's Diner
The code produces the following URL
http://www.mycompany.com/registrationHandler.jsp?particpant_name=Johnny
The response.encodeURL is stopping on the single quote contained in "Johnny's Diner"
The URL I want is:
http://www.mycompany.com/registrationHandler.jsp?particpant_name=Johnny's Diner&day_nb=1
How do I account for the embedded single quote so the code works properly? Thanks In Advance!You really need to read up on [SQL Injection|http://en.wikipedia.org/wiki/SQL_injection] and [XSS/Cross-Site Scripting|http://de.wikipedia.org/wiki/Cross-Site_Scripting]. Both present massive security problems and your code seems prone to easily producing both.
For SQL Injection attacks the correct solution is to always use PreparedStatements with only hard-coded String (i.e. never use String concatenation to build SQL statements).
For XSS attacks the solution is a bit harder, but basically you need to learn never to trust user input (that includes user input that you've previously stored in the database!) and always escape what the user sent when you print it back out. -
How to construct a sql query when field having single quote
Hi all,
I have been working on web application , here is my requirement:
I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote.
while executing the query it is getting problem because of single quote .. so how do i resolve my problem.
single quote should be there. (I'm using Ms-Access as my database).
Thanks in advance
abelUse PreparedStatement. Always. It not only eases setting Java objects in a SQL query, but also protects you against SQL injections.
Prepare yourself: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]. -
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.
Maybe you are looking for
-
i have 3 sites i have repeatedly saved as an app tab. on the rare occasions i exit my browser, my pinned tabs are missing. furthermore, when i attempt to "restore previous session", the tabs that were open may be restored but the pinned tabs are ALWA
-
Hello, I've been struggling with this issue for several days. I've read just about every piece of information I can find on google- document object models, xfa/xdp specifications, video tutorials, etc. I'm not exactly a beginner programmer, either. I
-
This is on my Apple TV (Gen 3), all updated. When I play the "Nursery Rhymes" radio station, it'll play one song and then go back to the iTunes Radio screen (out of the station screen). There will be no audio but the 'speaker' icon will be under the
-
Getting the company on one footer, and the web site on the other
Hi All, I am trying to get the correct footer on the correct page. I create proposals, and I have a 2-page master called "Proposal Base". The screenshots are below. I have created two text boxes on each, one for the information I want to show on that
-
Elements 10 Monitor area issue
When I am trying to edit to clip etc portions of project the monitor only shows static picture and not movie when I clik play button. /it did at one time.