Single quote in SPARQL query
Hi,
I have a SPARQL query with a clause like (?affy gb:bioprocess "3\'-phosphoadenosine" .). Oracle Jena adapter translates it into
sdo_rdf_match('(?affy <gb#bioprocess> "3\'||chr(39)||'-phosphoadenosine")..., which throws the following error when executing the query:
java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: oracle.spatial.rdf.server.TokenMgrError: Lexical error at line 1, column 50. Encountered: "\'" (39), after : "\"3\\"
ORA-06512: at "MDSYS.RDF_MATCH_IMPL_T", line 169
ORA-06512: at "MDSYS.RDF_MATCH_IMPL_T", line 35
ORA-06512: at line 4
What does Oracle Jena adapter expect if the SPARQL query has single quote in the literal value? Thanks,
Weihua
Hi,
What is your database version?
Could you list exactly the literal value you want to query? Please ignore any escapes. Is it as follows?
3'-phosphoadenosine
Thanks,
Zhe
Similar Messages
-
Hi,
I am inserting a string literal that contains one or more single quotes. I know i have to use two single quote ('') to represent one single quote in my insert query and four single quotes('''') to show two single quotes. However, when i do a select from the table, all single quotes are escaped with a backslash in front of it (\'). This cause some problem when i display the string in html page. How can i skip the back slash and keep only the single quote in my select query? Thanks
Kim TituKim,
To insert single quote or double quote string try using the ascii values as below -
CHR(34) ==> " (double quote)
CHR(39) ==> ' (single quote)
Example:
Insert into emp(EMPNAME) values(CHR(39)||'TEST'||CHR(39));
Now,
Select EMPNAME from emp;
will give you the result - 'TEST'
Regards,
Murali Mohan -
Hi all;
Can u please help me on the following dynamic query code ? I know I am missing the single quote around 2 dates but could not figure out where to put it ! I have tried putting 2 or 3 quotes around 2 bind vars but to no avail.
Want to create a dynamic query to simulate the the following:
select
EMPNO,ENAME,JOB,MGR,HIREDATE from emp where HIREDATE >= to_date('01/01/1981','MM/DD/YYYY') and HIREDATE <= to_date('12/31/1982','MM/DD/YYYY');
dynamic code:
declare
v_q varchar2(4000);
begin
v_q :='select EMPNO,ENAME,JOB,MGR,HIREDATE from emp ';
V_q := V_Q
|| 'where HIREDATE >= '
|| 'to_date(' || :P_DATE1 || ',' ||'''MM/DD/YYYY''' || ' )'
|| 'and HIREDATE <= '
|| 'to_date(' || :P_DATE2 || ',' ||'''MM/DD/YYYY''' || ' )';
-- end the sql
v_q := v_q ||';';
dbms_output.put_line ('V_Q is ' || V_Q);
end;
Thanks.
Zendeclare
v_q varchar2(4000);
v_rec emp%rowtype;
v_cur sys_refcursor;
begin
v_q :='select EMPNO,ENAME,JOB,MGR,HIREDATE from emp ';
V_q := V_Q || 'where HIREDATE >= to_date(:P_DATE1,''MM/DD/YYYY'') and HIREDATE <= to_date(:P_DATE2,''MM/DD/YYYY'')';
dbms_output.put_line ('V_Q is ' || V_Q);
open v_cur
for v_q
using '01/01/1981',
'12/31/1982';
loop
fetch v_cur
into v_rec.empno,
v_rec.ename,
v_rec.job,
v_rec.mgr,
v_rec.hiredate;
exit when v_cur%notfound;
dbms_output.put_line('empno = ' || v_rec.empno);
dbms_output.put_line('ename = ' || v_rec.ename);
dbms_output.put_line('job = ' || v_rec.job);
dbms_output.put_line('mgr = ' || v_rec.mgr);
dbms_output.put_line('hiredate = ' || to_char(v_rec.hiredate,'MM/DD/YYYY'));
dbms_output.put_line('====================');
end loop;
close v_cur;
end;
V_Q is select EMPNO,ENAME,JOB,MGR,HIREDATE from emp where HIREDATE >=
to_date(:P_DATE1,'MM/DD/YYYY') and HIREDATE <= to_date(:P_DATE2,'MM/DD/YYYY')
empno = 7499
ename = ALLEN
job = SALESMAN
mgr = 7698
hiredate = 02/20/1981
====================
empno = 7521
ename = WARD
job = SALESMAN
mgr = 7698
hiredate = 02/22/1981
====================
empno = 7566
ename = JONES
job = MANAGER
mgr = 7839
hiredate = 04/02/1981
====================
empno = 7654
ename = MARTIN
job = SALESMAN
mgr = 7698
hiredate = 09/28/1981
====================
empno = 7698
ename = BLAKE
job = MANAGER
mgr = 7839
hiredate = 05/01/1981
====================
empno = 7782
ename = CLARK
job = MANAGER
mgr = 7839
hiredate = 06/09/1981
====================
empno = 7839
ename = KING
job = PRESIDENT
mgr =
hiredate = 11/17/1981
====================
empno = 7844
ename = TURNER
job = SALESMAN
mgr = 7698
hiredate = 09/08/1981
====================
empno = 7900
ename = JAMES
job = CLERK
mgr = 7698
hiredate = 12/03/1981
====================
empno = 7902
ename = FORD
job = ANALYST
mgr = 7566
hiredate = 12/03/1981
====================
empno = 7934
ename = MILLER
job = CLERK
mgr = 7782
hiredate = 01/23/1982
====================
PL/SQL procedure successfully completed.
SQL> SY. -
Single quotes problem with execute immediate
Thanks for considering to solve the issue.
[i]Situation:
I am trying to create a procedure to perform a set of operations. As part of that, I am trying to create a table using execute immediate statement. This create table statement has a select sub query where p_LOB3 is the variable for the procedure of datatype varchar2.
Problem :
I need to pass the variable p_LOB3 as single quoted as it is of type Varchar2. Also I need to enclose the entire create table query within single quotes. How do I specify this as it is throwing an error when the PL/SQL engine is parsing the single quotes in the query used twice for different purposes as mention earlier.
Query:
execute immediate'create table test5 as select min(contract_number)as contract_number,contact_id,max(line_of_business) as line_of_business from mytable group by contact_id having min(contract_number) = max(contract_number) and max(Line_of_business) = 'p_LOB3' ';Thank you Todd,
Is just worked fine.
New issue is: I am not able to put 2 such statements in a single procedure and execute. Before I give parameters to the procedure, PL/SQL engine is actually creating a view of the mytable and naming is as test5, as a result I am not able to create a table as there is a view with the same name.
Right now, the workaround I am using is to create three different procedures to create three such tables. I know this is not a good idea....can you please tell me if there is a better way.
Procedure
CREATE OR REPLACE PROCEDURE SP_CREATE_0_0(p_LOB1 IN varchar2, p_LOB2 IN varchar2)
IS
BEGIN
execute immediate 'create table test5 as select min(contract_number) as
contract_number,contact_id,max(line_of_business) as line_of_business from
mytable group by contact_id having min(contract_number) = max(contract_number)
and max(Line_of_business) = ' ' ' || p_LOB1 || ' ' ' ';
execute immediate 'create table test5 as select min(contract_number) as
contract_number,contact_id,max(line_of_business) as line_of_business from
mytable group by contact_id having min(contract_number) = max(contract_number)
and max(Line_of_business) = ' ' ' || p_LOB1 || ' ' ' ';
END SP_CREATE_0_0;
/ -
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 -
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). -
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]. -
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 -
How to use a single quote string in where condition
Hi,
I have one problem in building a query.
SELECT agx_drug_indication.record_id, agx_drug_indication.fk_ad_rec_id,
agx_drug_indication.drugindicationmeddraver, agx_drug.record_id,
agx_drug.fk_apat_rec_id,
REPLACE (agx_drug.medicinalproduct, '''', '''') AS "MEDICINALPRODUCT",
pack_imp_objects.fn_get_arisg_code
(147,
agx_drug_indication.drugindicationmeddraver
) AS "DRUGINDICATIONMEDDRAVER",
agx_drug.drugindication,
NVL (agx_drug.drugcharacterization, 1) AS "DRUGCHARACTERIZATION",
agx_safety_report.record_id, agx_safety_report.case_identifier_no,
agx_safety_report.fk_apat_rec_id,
pack_imp_objects.fn_meddra_llt_matching
(agx_drug_indication.drugindication,
agx_drug_indication.drugindication,
agx_drug_indication.drugindicationmeddraver,
1
) AS "LLT_CODE",
pack_imp_objects.fn_meddra_soccode_matching
(agx_drug_indication.drugindication,
agx_drug_indication.drugindicationmeddraver
) AS "PRIMARY_SOC_CODE",
pack_imp_objects.fn_meddra_soccode_matching
(agx_drug_indication.drugindication,
agx_drug_indication.drugindicationmeddraver
) AS "CASE_SOC_CODE",
pack_imp_objects.fn_meddra_pt_matching
(agx_drug_indication.drugindication,
agx_drug_indication.drugindication,
agx_drug_indication.drugindicationmeddraver
) AS "PT_CODE",
pack_imp_objects.fn_get_aer_id (11) AS "AER_ID"
FROM agx_drug_indication,
agx_drug,
agx_safety_report
WHERE agx_drug_indication.fk_ad_rec_id = agx_drug.record_id
AND agx_drug.fk_apat_rec_id = agx_safety_report.fk_apat_rec_id
AND agx_safety_report.case_identifier_no IS NOT NULL
AND agx_drug_indication.drugindication IS NOT NULL
AND agx_drug.medicinalproduct =
REPLACE ('*-qVAGX_DRUG.MEDICINALPRODUCT*', '''', '''')
In the above query last line '-qVAGX_DRUG.MEDICINALPRODUCT' is a dynamic variable which may or may not contain the single quotes.
Ex: ABC's or just ABC.
The query has to support both single quote and without quote in it.
I wanted everything to be done in the sinlq query on not a PL/SQL Block.
Please help me ASAPkumar0828 wrote:
<font color="#FF0000"> ... </font>
REPLACE (agx_drug.medicinalproduct, '''', '''') AS "MEDICINALPRODUCT",
<font color="#FF0000"> ... </font> <pre>
REPLACE (agx_drug.medicinalproduct, '<font style="background-color: #E7FA6B">''</font>', '<font style="background-color: #E7FA6B">''</font>')
</pre>
With the above statement you are replacing single quote with another single quote
(which is nonsense).
<font color="#FF0000"> ... </font>
AND agx_drug.medicinalproduct = REPLACE ('*-qVAGX_DRUG.MEDICINALPRODUCT*', '''', '''')
In the above query last line '-qVAGX_DRUG.MEDICINALPRODUCT' is a dynamic variable which may or may not contain the single quotes.This is not a dynamic variable but a string value:
<pre>
AND agx_drug.medicinalproduct =
REPLACE (<font style="background-color: #FF3D55">'*</font>-qVAGX_DRUG.MEDICINALPRODUCT<font style="background-color: #FF3D55">*'</font>, '<font style="background-color: #E7FA6B">''</font>', '<font style="background-color: #E7FA6B">''</font>')
</pre>
*-qVAGX_DRUG.MEDICINALPRODUCT* <pre>
AND agx_drug.medicinalproduct =
REPLACE (<font style="background-color: #FF3D55">q'*</font>-qVAGX_DRUG.MEDICINALPRODUCT<font style="background-color: #FF3D55">*'</font>, '<font style="background-color: #E7FA6B">''</font>', '<font style="background-color: #E7FA6B">''</font>')
</pre>
-qVAGX_DRUG.MEDICINALPRODUCT q'[a]' => a
q'[a']' => a'
q'[a'']' => a''
q'*a*' => a
q'*a'*' => a'
q'*a''*' => a''
A variable also cannot contain a dot (.):
<pre>VAGX_DRUG<font style="background-color: #FF3D55">.</font>MEDICINALPRODUCT</pre>
Ex: ABC's or just ABC.
The query has to support both single quote and without quote in it.
I wanted everything to be done in the sinlq query on not a PL/SQL Block.
Please help me ASAPTry this:
<pre>
AND agx_drug.medicinalproduct = MY_VARIABLE
</pre> -
How to pass a single quote in a URL using Javascript
Can someone tell me how to pass a single quote in a URL using Javascript. I have created a Javascript funciton in which I pass several column values from an APEX report.
The URL for the report link I am using is "JAVASCRIPT:passBack('#EMP_ID#','#Name#','#e-mail#')"
The problem occurs with the Name and e-mail columns contain a single quote (i.e. James O'Brien)Thank you Saad, that worked.
Since I built the report using type 'SQL Query (PL/SQL function fody returning SQL query)' I had to add some additional quotes to get it to work.
i.e.
replace(EMP_EMAIL_NAME,'''''''',''\'''''')
or
replace(EMP_EMAIL_NAME,chr(39),''\'''''')
Thanks for the help,
Jason -
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
JeffIf 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 -
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. -
Issue searching a content with a single quote in title using matches
Hi,
I'm trying to search a content which has a single quote in its title by using the following code:
ISCSSearchAPI searchAPI = app.getUCPMAPI ().getActiveAPI ().getSearchAPI ();
ISCSSearchQuery query = (ISCSSearchQuery)app.getUCPMAPI ().createObject (ISCSSearchQuery.class);
query.setQueryText(queryText);
ISCSSearchResponse response = searchAPI.search(scsContext, query);
when the query text is: dDocTitle <matches> `What's New`
an exception occurs:
Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
Exception in thread "main" com.stellent.cis.client.command.CommandException: Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
at com.stellent.cis.server.api.scs.impl.SCSCommand.executeRequest(SCSCommand.java:338)
at com.stellent.cis.server.api.scs.impl.SCSCommand.execute(SCSCommand.java:222)
at com.stellent.cis.client.command.impl.services.CommandExecutorService.executeCommand(CommandExecutorService.java:57)
at com.stellent.cis.client.command.impl.CommandFacade.executeCommand(CommandFacade.java:158)
at com.stellent.cis.client.command.impl.BaseCommandAPI.invokeCommand(BaseCommandAPI.java:84)
at com.stellent.cis.client.api.scs.search.impl.SCSSearchAPI.search(SCSSearchAPI.java:52)
at com.guycarp.cm.service.ContentQueryService.search(ContentQueryService.java:133)
at com.guycarp.cm.service.ContentQueryService.main(ContentQueryService.java:168)
Caused by: com.stellent.cis.server.api.scs.request.SCSRequestException: Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.checkBinderForErrors(SCSRequestProcessor.java:357)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.validateResponse(SCSRequestProcessor.java:273)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.processRequest(SCSRequestProcessor.java:118)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:61)
at com.stellent.cis.server.api.scs.request.stream.SCSOptimizedPublishFilter.handleRequest(SCSOptimizedPublishFilter.java:128)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
at com.stellent.cis.server.api.scs.request.stream.SCSOptimizedRetrieveFilter.handleRequest(SCSOptimizedRetrieveFilter.java:250)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
at com.stellent.cis.server.api.scs.request.rewrite.SCSRewriteURLFilter.handleRequest(SCSRewriteURLFilter.java:140)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
at com.stellent.cis.server.api.scs.request.cache.impl.SCSServiceCacheFilter.handleRequest(SCSServiceCacheFilter.java:104)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
at com.stellent.cis.server.api.scs.request.impl.SCSRequestExecutorProxy.execute(SCSRequestExecutorProxy.java:105)
at com.stellent.cis.server.api.scs.impl.SCSCommand.executeViaProxy(SCSCommand.java:353)
at com.stellent.cis.server.api.scs.impl.SCSCommand.executeRequest(SCSCommand.java:335)
but the query text dDocTitle <contains> `What's New`
works fine.
Is there any escape character that I should be using for the single quote when we use <matches> operator?
Facing the same issue when searching from the content server console.
Any idea!
Thanks,
AnilThere seems to be none OOTB, but you can define it, see http://docs.oracle.com/cd/E25054_01/doc.1111/e10792/c05_search.htm#CHDIEECF
-
XML invalid character - a single quote problem
Hi, I am reading in an xml file, then write the file to output. The problem is that the input file has a strange single quote character [ *�* ] - lets call it single quoate A, which is different from [ *'* ] , that is the key next to the [ ; ] key on an English keyboard - lets call it single quate B. And in fact there isnt a key to input single quote A, I guess the appearance of single quote A is due to encoding.
If I open the input xml file in browser, it works ok and displays the single quote A.
Once I read in the xml file into memory, by debugging I can still see that single quote A is corrected encoded;
However once I rewrite the same content to output, the single quote A character is changed, and if i open the file in browser, it says 'invalid character' because single quote A were changed when written to output and cannot be rendered.
Both input and output xml are using UTF-8 encoding. How can I solve this problem please?
The xml file looks:
<?xml version="1.0" encoding="UTF-8" ?>
<content>....1980�s (Peacock and Williams, 1986; Keay, 1984)</content> My code for reading
String _xquery ="//content/text()";
Document _xmlDoc= DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("myxml.xml");
XPath _xpath = XPathFactory.newInstance().newXPath();
NodeList nodes = (NodeList) _xpath.compile(query).evaluate(_xmlDoc, XPathConstants.NODESET);
List<String> res = new ArrayList<String>(nodes.getLength());
for (int i = 0; i < nodes.getLength(); i++) {
res.add(nodes.item(i).getNodeValue());
String valueToOuput=res.toString() //this is the value to be output to xml, it shoud look like "[....1980�s (Peacock and Williams, 1986; Keay, 1984)]"my code for writing xml
Element root=new Element("root");;
Element content= new Element("output-content")
content.setText(valueToOutput);
root.addContent(content);
PrintWriter writer = new PrintWriter(new FileWriter(f));
new XMLOutputter().output(domDocument, writer);
writer.close();Hi, sorry I have fixed the problem... instead of using PrintWriter, I used Fileoutputstream, and it solved the problem. Thanks!
-
How to pass a string variable in a single quote
Hi,
I am trying to pass a single quoted string, 'some string', into a concat expression.
My situation is some thing like
I have an array of states
<copy>
<from>
<ListOfValues xmlns="http://tbone.coi.test/amis">
<!-- State -->
<Value>A</Value>
<Value>B</Value>
<Value>C</Value>
</ListOfValues></from>
<to variable="StateList"/>
</copy>
then I loop through the StateList array to get each state as
<copy>
<from variable="StateList" query="/tns:ListOfValues/tns:Value[bpws:getVariableData('iterator')]"></from>
<to variable="currentState"/>
</copy>
I then build an xpath expression like:
<copy>
<from expression="concat('/nsxml0:GetSummariesResponse/nsxml1:Summaries[nsxml1:State = ',bpws:getVariableData('currentState'), ']')"></from>
<to variable="xpath"/>
</copy>
As the result, my xpath look like:
/nsxml0:GetSummariesResponse/nsxml1:Summaries[nsxml1:State = A]
but I need a state surrounded by single quote as 'A' or xpath query like
/nsxml0:GetSummariesResponse/nsxml1:Summaries[nsxml1:State = 'A']
Any ideas how can I single quote a value of bpws:getVariableData('currentState') in my concat expression
Thanks,
-VHave you tried 'the string contain''s an ''?
Maybe you are looking for
-
How to assigne multiple value in key of read table
Hi gurus, I want read table xxxx with key field1 = ' xxx' or field1 = 'yyy'. how to assign multiple value as key for the same field while reading internal table. Regards sagar
-
Plasma Screen OK to test interlacing issues?
Having interlacing issues with my 24P footage and IMac monitor. If I output to my plasma screen, is this the same as any NTSC monitor in regard to checking/monitoring interlace issues?
-
Is there any danger subjecting a WRE54g to below freezing temperatures?
Is there any danger subjecting a WRE54g to below freezing temperatures? I am using the repeater to relay an AP to a guard shack while working. I have the repeater in my car running on a power inverter about 500 feet away. I live in the northeast and
-
Phone shows duplicate and wrongly sorted contact e...
Have synched my 6303 Classic with my contacts in Outlook 2003 SP3 on XP Nokia communication centre (from PC suite 7.1.30.9) looks perfect - my contact list is fine and sorted by first name, last name Unfortunately my phone is sorted last name, first
-
I am trying to restore my satellite M55-s1001 to factory settings but my DVD drive isn't working. It spends but isn't reading. I was wondering is there a way that I could use a USB method to reset the laptop... Desperate need of help!!!!!