Stored proc,For xml
Hi!
I recieve "Unexpected token type" exception when I try to
retrieve result from an stored procedure resultset and
while executing Query by "for xml" clause in MS Sql Server.
Can anybody help me!?
Thanks very much!
After your reply I found the problem result myself!
Your reply invoced my chance routin!
Similar Messages
-
XML Parsing in Java Stored Proc--Oracle XML Support Installation?
I am working with a third party product that is having difficulty running a java stored proc that is parsing a supplied XML file. The proc basically looks like:
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
InputStream is = getXMLAsInputStream(xml);
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( is );
... parse the document ....
catch (FactoryConfigurationError e) {
// unable to get a document builder factory
We are running on 9.2.0.6, HP-UX 64-bit. At first, when we would attempt to run the proc, a database hang would occur; now after attempting to install using loadjava jars for xerces2.6: ORA-29532: Java call terminated by uncaught Java exception:
javax.xml.parsers.FactoryConfigurationError: Provider
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found)
The vendor says that the errors we are getting when running are not due to any dependency on xerces or jre1.4, and that we need to "install Oracle XML support", but I'm not certain what this means (I cannot find any documentation on what to install). I believe that there are jars that need to be loaded into the database to support the XML parsing, as jre1.3 does not include built-in XML support, and Oracle 9.2.0.6 uses jre1.3.
So...does anyone have any thoughts as to how to resolve the missing references? Is there a way to "install Oracle XML support", or is it to install the necessary jars?
Thanks,
CandiCandi,
The following resources should be of help:
Oracle9i Database Release 2 (9.2) Documentation Library
In particular, check out the following:
Java Developer's Guide
Java Stored Procedures Developer's Guide
XML API Reference - XDK and Oracle XML DB
XML Database Developer's Guide - Oracle XML DB
XML Developer's Kits Guide - XDK
If that doesn't help, then try the following:
OracleJVM and Java Stored Procedures
XML Technology Center
Good Luck,
Avi. -
BizTalk Stored Proce-passing XML as one of the Input parameter and String as another parameter
I have a requirement in BizTalk that
- I will receive XML from Source and i need to submit this XML data and two other string parameters in SQL storeprocedure as a parameters and submit data
Ex: My_SP(myID Integer INPUT,myXML xml Input,mystring OUT)
Could you please help me how call storeprocedure and submit multiple parameters in BizTalk.you can execute stored procedure by generating schemas from WCF-SQL Adapter.
for passing parameters you will have to do the mapping to the Generated schema for Stored proc.
I would suggest to do this in Message Assignment shape, there you can easily assign all the parameters.
Integer and String parameters can be assigned from normal variables and XML parameter can be inserted as suggested by Abhishek-
xmldoc=requestMsg;
varOuterstring=xmldoc.Outerxml.Tostring();
Please refer the below article.
https://www.packtpub.com/books/content/new-soa-capabilities-biztalk-server-2009-wcf-sql-server-adapter
http://msdn.microsoft.com/en-us/library/dd787968.aspx
Thanks,
Prashant
Please mark this post accordingly if it answers your query or is helpful. -
** How to use TO_DATE function in Stored Proc. for JDBC in ABAP-XSL mapping
Hi friends,
I use ABAP-XSL mapping to insert records in Oracle table. My Sender is File and receiver is JDBC. We use Oracle 10g database. All fields in table are VARCHAR2 except one field; this is having type 'DATE'.
I use Stored procedure to update the records in table. I have converted my string into date using the Oracle TO_DATE function. But, when I use this format, it throws an error in the Receiver CC. (But, the message is processed successfully in SXMB_MONI).
The input format I formed like below:
<X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">
Value in Payload is like below.
<X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">TO_DATE('18-11-1991','DD-MM-YYYY')</X_EMP_START_DT>
Error in CC comes as below:
Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_EMP_DETAILS' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('18"
Friends, I have tried, but unable to find the correct solution to insert.
Kindly help me to solve this issue.
Kind Regards,
Jegathees P.
(But, the same is working fine if we use direct method in ABAP-XSL ie. not thru Stored Procedure)Hi Sinha,
Thanks for your reply.
I used the syntax
<xsl:call-template name="date:format-date">
<xsl:with-param name="date-time" select="string" />
<xsl:with-param name="pattern" select="string" />
</xsl:call-template>
in my Abap XSL. But, its not working correctly. The problem is 'href' function to import "date.xsl" in my XSLT is not able to do that. The system throws an error. Moreover, it is not able to write the command 'extension-element-prefixes' in my <xsl:stylesheet namespace>
May be I am not able to understand how to use this.
Anyway, I solved this problem by handling date conversion inside Oracle Stored Procedure. Now, its working fine.
Thank you. -
New Stored Proc For Patch 20 ? SBO_SP_PostTransactionNotice
Does anyone know more information about this stored proc and at what stage it is fired?
I assume it is after an object has been "Added, Updated, closed etc..."
and this will allow us to then perform some actions
Is this correct
Please HelpHi all,
Just adding some info. The SAP Note 1039449 says the following:
<i>Three new stored procedures were added to the database:
1. SBO_SP_TransactionSupport
2. SBO_SP_PostTransactionNotice
3. SBO_SP_PostTransactionSupport
The stored procedures SBO_SP_TransactionSupport and
SBO_SP_PostTransactionSupport are encoded and cannot be edited by the user.
The stored procedure SBO_SP_PostTransactionNotice is open for editing like
the SBO_SP_TransactionNotification stored procedure.
These stored procedures are executed before and after each transaction in
SAP Business One to ensure the correctness of the transaction.</i>
Still can't find time to test it, but if I understand well (actually I'm hoping this), we can now use the TN to correctly rollback a transaction, and the SBO_SP_PostTransactionNotice to correctly notify about transactions. Any test about this topic will very welcome.
Regards,
Ian -
Item Type Based on PL/SQL stored proc causing errors
I am getting the following error when I add this item type based on a pl/sql stored proc that generates html based on the stored proc... the stored proc returns find but the other porlets get Error Message in there headers and in the porlet content I get:
Error: The listener returned the following Message: 503 Service Unavailable....
I also get the same error if I click on a link that is generated from my stored proc for the entire page I get the error:
Error: The listener returned the following Message: 503 Service Unavailable
and get nothing else returned...Greetings
I suggest you take a look at the following page and have a look on how to create portlets. Since the PL/SQL PDK allows you to create your own portlets inside the Oracle Database there should be no problem for creating the content inside a portlet the way you want it.
http://www.oracle.com/technology/products/ias/portal/pdk.html
Best regards
Johan -
Using Stored Proc with CMP - Possible?
Is it possible for me to use a stored proc for my CMP bean instead of the usual inline SQL?
sorry, I mean for the ID field.
-
System calls through Java stored Proc
Hi,
Aim: Execute host command from pl/sql thru java stored proc.
1. Created a java class to take system command that could be executed.
2. It runs fine when the class file is executed.
3. when the java file is loaded to database to access it as java stored proc, for any valid and invalid system commands it is giving out 'PL/SQL successfully completed.
Results were not seen.
4. Java source file.
import java.io.*;
import java.lang.*;
public class Util extends Object
public static int RunThis(String[] args) {
Runtime rt = Runtime.getRuntime();
int rc = -1;
String s = null;
try
Process p = rt.exec(args);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
System.exit(0);
catch (Exception e){
e.printStackTrace();
rc = -1;
finally {
return rc;
public static void main(String[] args){
Util.RunThis(args);
public static String exec(String args){
Util.RunThis(args);
return "Srini it is successful";
5. When ran from host prompt (unix),
executed successfully,
$ /opt/java1.3.1/bin/java Util /usr/bin/ls -l
Here is the standard output of the command:
total 30862
-rwxrwxrwx 1 xyz develope 1348218 Jan 2 17:47 02Jan03-2.zip
-rw-r----- 1 xyz develope 21864 Jul 9 2002 109-60_2_modified7.sql
-rw-r----- 1 xyz develope 44934 Jul 9 2002 109-60_2_modified8.sql
Here is the standard error of the command (if any):
xyz@xxxxx:abcd:/home/xyz
$
6. loadjava,
$ loadjava -user username/password Util.java
7. Create proc,
SQL> create procedure echo_input(s1 varchar2) as language java name 'Util.main(java.lang.String[])';
2 /
Procedure created.
8. Execute proc.
SQL> exec echo_input('/usr/bin/ls -l');
PL/SQL procedure successfully completed.
SQL> exec echo_input('/home/o_report/reports/rcli_ASCT &');
PL/SQL procedure successfully completed.
SQL> set serverout on
SQL> exec echo_input('/home/o_report/reports/rcli_ASCT');
PL/SQL procedure successfully completed.
SQL> exec echo_input('ddsafafasf');
PL/SQL procedure successfully completed.
TIA,
Srini.Hi Srini,
This is just a suggestion, but try entering the following commands (in your SQL*Plus session) before executing your stored procedure:
set serveroutput on size 1000000
exec dbms_java.set_output(1000000)Hope this helps.
Good Luck,
Avi. -
Parse XML in a java stored proc
I am trying to parse an xml document in a java stored procedure. Just following my nose, I have developed a stored proc that works fine in development (outside the database using JRE 1.4.1) using the Xerces 2.5 parser. But, after having transferred the xerces xercesImpl.jar, xmlapis.jar, and my implementation class into oracle using loadjava when I call my stored proc the code throws an exception trying to build the document with an error like:
NoClassDef exception org.apache.xerces.jaxp.DocumentFactoryBuilderImpl
My Code looks like this:
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
InputStream is = getXMLAsInputStream(xml);
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( is );
... parse the document ....
catch (FactoryConfigurationError e) {
// unable to get a document builder factory
The exception caught is a FactoryConfigurtionError.
I'm not particularly attached to xerces, I'm really just looking for a way to parse XML inside my java stored proc, so any help to solve my problem, or an alternative suggestion will be greatly appreciated.
thanks
DaleI looked again and sure enough the xerces implementation classes were missing. I had run a .cmd file containing these two lines, but it looks like only the first one ran...
loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xml-apis.jar
loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xercesImpl.jar
Now I've got everything working fine with Xerces!
Dale -
File to JDBC :Error when executing statement for table/stored proc.
Hi,
I am getting following error when i am trying to insert data into z-table using JDBC recr adapter.
Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'ZTEST' (structure 'STATEMENT'): java.sql.SQLException: <u>[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name '<b>ZTEST</b>'.</u>
But the database table name 'ZTEST' exists in the system.
XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_RECR xmlns:ns0="http://urn:srini/FileToJDBC">
<STATEMENT>
<TEST action="INSERT">
<table>ZTEST</table>
<access>
<ROLLNO>123</ROLLNO>
<FIRSTNAME>ABC</FIRSTNAME>
<LASTNAME>XYZ</LASTNAME>
</access>
</TEST>
</STATEMENT>
</ns0:MT_RECR>
Regards,
SrinivasHi,
I have changed my MT str but still getting the same error.Is it possible to insert/ update a z-table using JDBC adapter.
XML str:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_RECR xmlns:ns0="http://urn:srini/FileToJDBC">
<STATEMENT>
<ZTEST action="INSERT">
<access>
<ROLLNO>123</ROLLNO>
<FIRSTNAME>abc</FIRSTNAME>
<LASTNAME>XYZ</LASTNAME>
</access>
</ZTEST>
</STATEMENT>
</ns0:MT_RECR>
Regards,
Srinivas -
Here's how to pass XML as a parameter to an Oracle stored proc
This, or something like it, should be all over the web and I intend to do so.
The first sample has exactly what you need in order to pass "XML" as a parm to a stored proc.
http://www.oracle-base.com/forums/viewtopic.php?f=2&t=8468> Really, what is the difference between the 2?
"What is a...?" questions are easily answered by Google. Generally speaking, however, "JavaScript" is Netscape's implementation of ECMAScript, a scripting language primarily for client-side development for a web browser. "Java" is an entire platform, but typically refers to an object-oriented programming language that is typically compiled to bytecode and run in a virtual machine.
They're not the same thing at all.
~ -
Error when executing statement for table/stored proc DB2 - Data Truncation
Hi,
I have one call sp in XI with n parameters int and two parameters out.
well, to implement the interface gives the following error
com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SPSAPAR9' (structure 'Statement'): java.sql.SQLException: The number of parameter values set or registered does not match the number of parameters
Thanks for your help
Ximena
Edited by: Ximena Gonzalez on Feb 19, 2008 11:50 AM
Edited by: Ximena Gonzalez on Feb 20, 2008 12:17 PMMy Error is change
Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SAPPRG.SPSAPAR9' (structure 'Statement'): java.sql.DataTruncation: Data truncation
but de change DT SP
<?xml version="1.0" encoding="UTF-8" ?>
<ns1:AlistReqDet2_MT xmlns:ns1="urn:proxl:tmuc:proxl01:AlistReqItems">
<Statement>
<SPSAPAR9 action="EXECUTE">
<table>SAPPRG.SPSAPAR9</table>
<ISAPNU1 isInput="TRUE" type="STRING">0080000353</ISAPNU1>
<ISAPEM1 isInput="TRUE" type="STRING">'LU'</ISAPEM1>
<ISAPC05 isInput="TRUE" type="STRING">15353</ISAPC05>
<ISAPSEC isInput="TRUE" type="STRING">10</ISAPSEC>
<ISAPLOT isInput="TRUE" type="STRING">'lats'</ISAPLOT>
<ISAPCA1 isInput="TRUE" type="STRING">10</ISAPCA1>
<ISAPCA2 isInput="TRUE" type="STRING">10</ISAPCA2>
<ISAPKIL isInput="TRUE" type="STRING">10</ISAPKIL>
<ISAPES1 isInput="TRUE" type="STRING">'T'</ISAPES1>
<ISAPSW isOutput="TRUE" type="STRING" />
</SPSAPAR9>
</Statement>
</ns1:AlistReqDet2_MT> -
Error when executing statement for table/stored proc. : ORA-00911
Hi All,
I am posting IDOC->XI->JDBC, approx 5000 Idocs.
But few messages are giving following error in XI-_SXMB_MONI
Can any one guide me what is the cause of error? I check whole Idoc data I am not able to see bad character? can any once guide me what are the bad character in XML to post data in oracle? so that i can search in XML and how to avoide this error.
"com.sap.aii.af.ra.ms.api.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'HRP1001' (structure 'INSERT_PAD34'): java.sql.SQLException: ORA-00911: invalid character"> I am talking about following IDOC.<ZRMD_A06> ->
> <E1PLOGI SEGMENT="1">-> <E1PITYP SEGMENT="1"> ->
> <E1PAD34 SEGMENT="1"> -><PROZT>0.00 #</PROZT>.
> Can we remove this # during message mapping in XI??
sure you can remove it using Replace function or by writing UDF.
as I am seing # is last character..<b>so remove # with " " (single space) and then use the TRIM fucntion.</b>
Thanks
Farooq.
*<b>Rewards points if you find it useful*</b> -
Getting error while invoking relational physical DS for sybase stored proc
*com.bea.dsp.das.exception.DASException: com.bea.dsp.wrappers.rdb.exceptions.RDBWrapperException: {bea-err}RDBW0004: Error executing SQL query: [BEA][Sybase JDBC Driver][Sybase]SELECT INTO command not allowed within multi-statement transaction+.*
I have created a physical DS function using "relational" in the wizard and connecting to sybase ASE stored procedure that is in unchained mode. I had configured the JDBC pool using BEA sybase non-XA 12.x driver.
When i run the physical DS (or logical DS), i get the above error. The sybase srever(and stored proc) is hosted by an external system and right now i do not have access/contacts to change anything.
After hours spent googling, it appears that the fix may possibly be setting "set chained off" before calling the stored proc. To achieve that, i tried the below two methods but nothing seems to work:
- In the JDBC URL, set property via ?chained=off (also tried false instead of "off")
- In Admin console/JDBC connection pool configuration/initSQL tried "SQL SET CHAINED OFF" and "SET CHAINED OFF"
My ODSI version is 10gR3
Oracle Workshop for WebLogic
Version: 10.3
Build id: 1137967
I tried using java physical DS and get the same error. I wrote a test stored proc in my local PC sybase ASE and it runs fine. But i connected as "sa".
I would like to exhaust all possible options from my side before making the long process of getting something changed in the external sybase DB like setting the proc mode to "anymode".
Please help.
Thank you.mikereiche wrote:
Did the test stored proc use "SELECT INTO"?Yes. But it did not do much(code below)
>
Was the test stored proc tagged the same as the one that fails (chained/unchained?)Yes. "sp_procxmode" confirms that the test stored proc is in "unchained" transaction mode.
>
Can you get jdbc code that successfully calls the stored proc using the datasource?Yes, my colleague was trying the jdbc code and i was trying in the workshop with relational. She has left for the day so will post tomorrow. Please note that this is only for the test stored proc. The java jdbc also gets the same error for the "real" stored proc.
>
BTW - if you used "SET CHAINED OFF" as initSql, unless you have a table named SET, the sql will fail and the datasource will not be created. So that casts some doubt on whether the other setting "SQL SET CHAINED OFF" was applied.
Also - the connections are reset to default when they are returned to the connection pool, so I think "SQL SET CHAINED OFF" should be used as the "Test Table Name" and Test On Reserve should be checked.Tried it now, but it does not work. I'm getting the same error.
test stored proc:
create procedure dbo.getCustomerMulti @cid_inp varchar(40)
as
begin
select dbo.Customer.FirstName, dbo.Customer.cid, dbo.Customer.LastName, dbo.Customer.DateCreated, dbo.Customer.id into #temp from dbo.Customer
select dbo.Customer.FirstName, dbo.Customer.cid, dbo.Customer.LastName, dbo.Customer.DateCreated, dbo.Customer.id from dbo.Customer where cid LIKE @cid_inp + '%'
end
Thank you. -
Error when executing statement for table/stored proc
Hi All,
I am getting this error when executing IDOC to JDBC (Stored Procedure) Scenario.
In my stored procedure I have three insert statements to insert rows in to 3 tables.
This stored procedure is working fine for two insert statements i.e,
For this I have created data type for stored procedure with 10 elements and executed the scenario and was successfully running.
when I added 3rd insert statement to stored procedure ie., when i added 5 more elements to the datatype (totally 15 elements) it starts giving the bellow error in Message Monitoring.
<i><b>Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
<i><b>Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
Note:- I have run the stored procedure with three insert statements in Sql Server, and also by calling an external program also, and was working fine.
<i><b> Note : Is there any structure needs to be follow when working with IDOC to Stored procedure.</b></i>
I am struck up with the error, can any body resolve this issue.
Thanks in Advance,
MurthyHi narasimha,
This seems to be any error due to incorrect query formation.In your receiver jdbc channel set the parameter logSQLstatement = true.you can find this parameter in the advanced mode. Using this parameter you will be able to see the sql query which is generated at runtime in the audit log in RWB.
Regards,
Pragati
Maybe you are looking for
-
Loops not playing right in GB3
I had a project I had created in GB2, and recently needed to open it and do some more stuff to it for a new project. The odd thing is, a couple of the loops (midi) that worked fine, play with the wrong sound now in GB3. For instance, Mellow Latin Con
-
Please help!!! Tuning the query
Hi, I am using Oracle BDBXML 2.4.16. In the following, policyContainer.dbxml has around 1000 documents and productsContainer.dbxml around 10 documents. The following query is taking around 6 - 8 seconds to fetch the data of around 300 records. I have
-
Query with error "...Invalid Identifier"
Hi I have a query that returns an error as follows: ORA-00904: "AT_HOURLY_ATTENDANCE_RECORDS"."ABSENCE_TYPE": invalid identifier The code is as follows: SELECT AT_HOURLY_ATTENDANCE_RECORDS.absence_type AS "value", AT_HOURLY_ATTENDANCE
-
Cancellation of billing document - message OIC_SDP 008
Hello Group, We have IS-OIL(downstream) version 4.6C and doing cancellation of billing document. After saving, it gives message no.OIC_SDP 008 and not getting posted to FI. Pl.advise me. Regards, Kedar.
-
IDoc / Business Connector - future developments
hi, I would like to know some possibilities to transfer data from a non-sap-system to a sap-system. I think the IDoc-interface is really good for transporting data into SAP-systems. I have spoken with some people they mean that the IDoc-interface is