A space in xml-document is stored in database as New line feed instead of n
Hello,
I have got the following problem:
An xml-document is inserted by an xsql servlet into an object view. First this document is translated by an xsl file. Then an instead of trigger inserts the values into the right tables.
When a space is present (only one space no further string-value) in the xml-document then this space is inserted into the database as a new line feed.(chr(10))
When I add the following line to the tag
<bnr_name xml:space="preserve"> </bnr_name>
then the space is stored as a space. (chr(32))
What I want is that this space is inserted as a NULL- value.
Does anyone know a solution in xml or xsl? (Of course I can solve it on the database side by programming a function around it, but I want to solve it on the xml or xsl side)
Bye
jan-Paul Duister
Few questions which might help to understand the issue.
1. Is client's data is coming in more than 72 chars per each line? Then you can request client to send the data with max. 72 chars per line. Else dividing the string into 72 chars will loose the readability of text since logic can not be built to divide the text.
Start reading the text string starting from left for maximum 72 chars . If 72th character is non space then go backwards i.e. read 71, 70, 69... till last character should be a SPACE.
Eg. string is
'xxxxxxxxxxx...........This material is created for plant xyz. date of creation is 03.02.2009'.
x = string72(1) should be a SPACE else take x = string71(1) and likewise.
Similar Messages
-
Help in creating XML documents in ABAP using XI in new version ECC6.0
Hello All:
I am pretty comfortable with XML and XSLT but new to XI. Is there a way of creating XML documents in ABAP using XI in new version ECC6.0? Please provide me with any links or any information you may have. All the answers will be rewarded.
Thanks.
Mithunhi,
U cant create XML data in ABAP.
to send the data to the XI, u have to use the IDOC or RFC FM, from there IDOC or RFC adapters will read the data in the same format and these adapters will convert the data in to XML .Bcoz XI understand only XML data.
from there XI will process and route them to Destination, by using anthor adapter.
here u can use file adapter if u want data in file foramat from the IDOC or RFC .
So XI is the integration tool only.
reward points if helpful
ragards
sreeni -
How to use java to create an XML document from an SQL database?
Hi,
I'm a complete novice at XML and have only recently started programming in Java.
I'm currently trying to develop a package in Java 1.1.8 which requires a set of very specifically formatted XML documents. These documents would need to be updated regularly by people with no knowledge of Java and I would like to make it as simple as possible.
Since the data will already be in an SQL database, I thought it might be possible to generate the XML documents from the data using a small Java application, but I'm not too sure how to go about this or if this is even possible! Any help or pointers in the right direction would be very much appreciated.
LouiseDo you have the option of upgrading to a newer version of the JDK?
JAXB does what you are wanting very easily. Also there are tools if you don't want to write your own. JAXB is available as early release on Sun's site as is the newest JDK. Otherwise, you have to design a factory and interface that will do this for you (which is what JAXB basically is in a very simplified view). -
The size of a XML document stored in a XMLType table
Is there a way to find out (via SQL) the size of a XML document stored in a XMLType table or XMLType column (storage OR based)?
For instance in the way you could it retrieve if the XML document was stored in an XMLType column (CLOB based)
SQL> r
1 select dbms_lob.getlength(t.gegevens.getclobval()) "SIZE"
2 from hgo.hgo010_detam t
3* where rownum < 2
SIZE
2750Is there a way to find out (via SQL) the size of a XML document stored in a XMLType table or XMLType column (storage OR based)?
For instance in the way you could it retrieve if the XML document was stored in an XMLType column (CLOB based)
SQL> r
1 select dbms_lob.getlength(t.gegevens.getclobval()) "SIZE"
2 from hgo.hgo010_detam t
3* where rownum < 2
SIZE
2750 -
How to extract the nodes of any given XML document ???
Hello,
Greetings! It is an interesting forum.
A Snippet of XML Schema PurchaseOrder.xsd as given in user guide is as follows
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
version="1.0" xdb:storeVarrayAsTable="true">
<xs:element name="PurchaseOrder" type="PurchaseOrderType"
xdb:defaultTable="PURCHASEORDER"/>
<xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T">
<xs:sequence>
<xs:element name="Reference" type="ReferenceType" minOccurs="1"
xdb:SQLName="REFERENCE"/>
<xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
<xs:element name="Reject" type="RejectionType" minOccurs="0"
xdb:SQLName="REJECTION"/>
<xs:element name="Requestor" type="RequestorType"
xdb:SQLName="REQUESTOR"/>
<xs:element name="User" type="UserType" minOccurs="1"
xdb:SQLName="USERID"/>
<xs:element name="CostCenter" type="CostCenterType"
xdb:SQLName="COST_CENTER"/>
<xs:element name="ShippingInstructions" type="ShippingInstructionsType"
xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
<xs:element name="SpecialInstructions" type="SpecialInstructionsType"
xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
<xs:element name="LineItems" type="LineItemsType"
xdb:SQLName="LINEITEMS"/>
</xs:sequence>
</xs:complexType>
full schema is available in url
http://download-west.oracle.com/docs/cd/B12037_01/appdev.101/b10790/xdb03usg.htm#BABBGIED
The views use XPath expressions and functions such as extractValue() to define the mapping between columns in the view and nodes in the XML document. The following view is created on purchase order schema.
Creating Relational Views On XML Content
CREATE OR REPLACE view PURCHASEORDER_MASTER_VIEW
(REFERENCE, REQUESTOR, USERID, COSTCENTER,
SHIP_TO_NAME,SHIP_TO_ADDRESS, SHIP_TO_PHONE,
INSTRUCTIONS)
AS
SELECT extractValue(value(p),'/PurchaseOrder/Reference'),
extractValue(value(p),'/PurchaseOrder/Requestor'),
extractValue(value(p),'/PurchaseOrder/User'),
extractValue(value(p),'/PurchaseOrder/CostCenter'),
extractValue(value(p),'/PurchaseOrder/ShippingInstructions/name'),
extractValue(value(p),'/PurchaseOrder/ShippingInstructions/address'),
extractValue(value(p),'/PurchaseOrder/ShippingInstructions/telephone'),
extractValue(value(p),'/PurchaseOrder/SpecialInstructions')
FROM PURCHASEORDER p;
When we register XML Schema in Oracle 9i, the schema elements of XML documents are stored as XMLType, that is, stored using object-relational storage techniques.
For a small schema, we could build the above view manually, but for large/nested schema, if we have query to build XML documents node list, it will help us to build Relational Views on XML Content.
How do we extract the nodes of any given XML document through O-R structures or XML DB using XML DB functions?
Any alternate thoughts are welcome.
I appreciate your help.
Regards
RamRam
Once again, I do not think that you can solve the problem you are trying to solve. Fundamentally you need to determine for a given element of a given complex type what are it's child elements. For each of those elements you then need to find out whether or not it in turn has child elements...
Then you have to think about elements defined as ref rather than type, elements that are substituteable, and the rest of possibilities that can be described with XML Schema.
If you can solve that problem you're a better man than I as the saying goes. Anyone rather than give you a fish, I'll show you how to at least put a worm on the hook..
The following query gets the names of the elements inside a each of the global complex types
Good luck, if you come up with a query to do this I'd love to see it...
SQL> column COMPLEX_TYPE format A32
SQL> column ELEMENT format A32
SQL> --
SQL> select extractvalue
2 (
3 value(ct),
4 '/xs:complexType/@name',
5 'xmlns:xs="http://www.w3.org/2001/XMLSchema"'
6 ) COMPLEX_TYPE,
7 extractvalue
8 (
9 value(et),
10 '/xs:element/@name',
11 'xmlns:xs="http://www.w3.org/2001/XMLSchema"'
12 ) ELEMENT
13 from resource_view,
14 table
15 (
16 xmlsequence
17 (
18 extract
19 (
20 res,
21 '/r:Resource/r:Contents/xs:schema/xs:complexType',
22 'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"
23 xmlns:xs="http://www.w3.org/2001/XMLSchema"')
24 )
25 ) ct,
26 table
27 (
28 xmlsequence
29 (
30 extract
31 (
32 value(ct),
33 '/xs:complexType/*/xs:element',
34 'xmlns:xs="http://www.w3.org/2001/XMLSchema"'
35 )
36 )
37 ) et
38 where equals_path(res,'/home/SCOTT/poSource/xsd/purchaseOrder.xsd') = 1
39 /
COMPLEX_TYPE ELEMENT
-------------------------------- ------------------------PurchaseOrderType Reference
PurchaseOrderType Actions
PurchaseOrderType Reject
PurchaseOrderType Requestor
PurchaseOrderType User
PurchaseOrderType CostCenter
PurchaseOrderType ShippingInstructions
PurchaseOrderType SpecialInstructions
PurchaseOrderType LineItems
LineItemsType LineItem
LineItemType Description
LineItemType Part
ActionsType Action
RejectionType User
RejectionType Date
RejectionType Comments
ShippingInstructionsType name
ShippingInstructionsType address
ShippingInstructionsType telephone
19 rows selected. -
Problem with encoding of xml document
while parsing an xml document with SAX parser, i found that encoding of the xml document received as input stream is "ISO-8859-1" . After parsing certain fields has to be stored in the mysql table where table character set is "utf8" . Now what i found that ceratin characters in the original XML document are stored as question mark (?) in the database.
1. I am using mysql 4.1.7 with system variable character_set_database as "utf8". So all my tables have charset as "utf8".
2. I am parsing some xml file as inputsream using SAX parser api (org.apache.xerces.parsers.SAXParser ) with encoding "iso-8859-1". After parsing certain fields have to be stored in mysql database.
3. Some XML files contain a "iso-8859-1" character with character code 146 which appears like apostrophes but actually it is : - � and the problem is that words like can�t are shown as can?t by database.
4. I notiicied that parsing is going on well and character code is 146 while parsing. But when i reterive it from the database using jdbc it shows character code as 63.
5. I am using jdbc to prepared statement to insert parsed xml in the database. It seems that while inserting some problem occurs what is this i don't know.
6. I tried to convert iso-8859-1 to utf-8 before storing into database, by using
utfString = new String(isoString.getBytes("ISO-8859-1"),"UTF-8");
But still when i retreive it from the databse it shows caharcter code as 63.
7. I also tried to retrieve it using , description = new String(rs.getBytes(1),"UTF-8");
But it also shows that description contains character with code 63 instead of 146 and it is also showing can�t as can?t
help me out where is the problem in parsing or while storing and retreiving from database. Sorry for any spelling mistakes if any.duggal.ashish wrote:
3. Some XML files contain a "iso-8859-1" character with character code 146 which appears like apostrophes but actually it is : - ’ and the problem is that words like can’t are shown as can?t by database.http://en.wikipedia.org/wiki/ISO8859-1
Scroll down in that page and you'll see that the character code 146 -- which would be 92 in hexadecimal -- is in the "unused" area of ISO8859-1. I don't know where you got the idea that it represents some kind of apostrophe-like character but it doesn't.
Edit: Actually, I do know where you got that idea. You got it from Windows-1252:
http://en.wikipedia.org/wiki/Windows-1252
Not the same charset at all. -
ISO-8559-1 XML document retrieval
Can an ISO-8559-1 XML document be stored in a database with a AL32UTF8 character set and then be retrieve ed as an ISO-8559-1 document again?
if not what need to be done to get the data saved and retrieved as ISO-8559-1.
Please HelpBy default document will be returned in the characater set requested by the client. Programatically you can use the getBlobVal() method to request a particular character set. I think you can also request a particular character set using XMLSerialize but I'm not sure of the top of my head if this part of the API was implemented / tested / exposed.
-
Link to documents stored in database on flext front end
Hi,
I am a newbie to Flex.Can you please help me out with the
procedure as how I can to provide a link on flex front end screen
which when clicked opens either pdf's,ppt's,word docs from
database. I am integrating the flex with spring and hibernate
also.can you please tell me how can I connect(Flex to Java
connection) to the document in the oracle database with the
link.All the documents are stored in database.So for example if a
user clicks on a link on flex frontend screen it needs to open a
pdf file whihc is stored in database.So can you please post me the
connection details as how flex calls java and inturn java calls
backend to get the document from database.I am using flex,Spring
and hibernate frameworks for the application..
Thanks in Advance
Chandu"chandu2406" <[email protected]> wrote in
message
news:gju0i3$ov0$[email protected]..
> Hi,
>
> I am a newbie to Flex.Can you please help me out with
the procedure as how
> I
> can to provide a link on flex front end screen which
when clicked opens
> either
> pdf's,ppt's,word docs from database. I am integrating
the flex with spring
> and
> hibernate also.can you please tell me how can I
connect(Flex to Java
> connection) to the document in the oracle database with
the link.All the
> documents are stored in database.So for example if a
user clicks on a link
> on
> flex frontend screen it needs to open a pdf file whihc
is stored in
> database.So
> can you please post me the connection details as how
flex calls java and
> inturn
> java calls backend to get the document from database.I
am using
> flex,Spring and
> hibernate frameworks for the application..
Let's start with the basics:
Do you already have an understanding of how you'd perform
these steps if
Flex were not involved (i.e. some sort of static or dynamic
html page in the
browser)? -
XML-Document with special characters
Hallo
i have an oracle database with a table of XmlType.
Now i want to insert the following document:
<message>
<to>[email protected]</to>
<from>[email protected]</from>
<subject>Question</subject>
<body>über den Wolken</body>
</message>
The problem is the special character "ü" which is transformed to "??". Must i declare a special character set? If yes - where? In the XML-Document or in the Database? And how must i do this?
Thank you very much
cu
HeidiHallo Raghu,
when i insert the following by iSqlPlus in Internet Explorer (on a German WinXP):
insert into xml_table_test values (xmltype ('<message><to>[email protected]</to><from>[email protected]</from><subject>Question</subject><body>über den Wolken</body></message>')) /
a new page is displayed with the following:
Substitution Variables
Enter values for substitution variables in the script to execute:
Variable Value
uuml
and in the inputfield above Value i can insert something (in my case "ü" - i think)
But i want to insert the documents with webdav and then i can´t do this...
when i select this:
select * from nls_session_parameters
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
PARAMETER VALUE
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
it´s all american --> must i change this to German/Europe? How?
Thank you very much
cu
Heidi -
Maximum file size of imported XML document
Is anyone able to tell me if there is a maximum size for XML files that you can import into a PDF document?? I need to know this as my client has a requirement for a very large data set within an interactive PDF generated using LiveCycle designer.
Thanks. I have posted this in the LiveCycle designer forum but have had no reply. I have posted instead within this forum as importing an XML document is not specific to LiveCycle Designer and is instead an Acrobat Pro task and therefore question.
-
How to parse an XML document with oracle8i
Has anyone a good link or an example how to decode and store an XML document into an oracle8i database.
I' ve found only good things for oracle9i.
Thank you
RogerHere is an example of parsing xml taken fro Oracle8i 8.1.7 xdk.
This one uses external OS files to pase, but could be easily converted to
use CLOB or VARCHAR2 string for parsing XML documents.
IF you wanted to use CLOB to store and manipulate xml documents you can use XMLParser and XMLDom
packages along with the DBMS_LOB package to do that.
-- This file demonstates a simple use of the parser and DOM API.
-- The XML file that is given to the application is parsed and the
-- elements and attributes in the document are printed.
-- The use of setting the parser options is demonstrated.
set serveroutput on;
create or replace procedure domsample(dir varchar2, inpfile varchar2,
errfile varchar2) is
p xmlparser.parser;
doc xmldom.DOMDocument;
-- prints elements in a document
procedure printElements(doc xmldom.DOMDocument) is
nl xmldom.DOMNodeList;
len number;
n xmldom.DOMNode;
begin
-- get all elements
nl := xmldom.getElementsByTagName(doc, '*');
len := xmldom.getLength(nl);
-- loop through elements
for i in 0..len-1 loop
n := xmldom.item(nl, i);
dbms_output.put(xmldom.getNodeName(n) || ' ');
end loop;
dbms_output.put_line('');
end printElements;
-- prints the attributes of each element in a document
procedure printElementAttributes(doc xmldom.DOMDocument) is
nl xmldom.DOMNodeList;
len1 number;
len2 number;
n xmldom.DOMNode;
e xmldom.DOMElement;
nnm xmldom.DOMNamedNodeMap;
attrname varchar2(100);
attrval varchar2(100);
begin
-- get all elements
nl := xmldom.getElementsByTagName(doc, '*');
len1 := xmldom.getLength(nl);
-- loop through elements
for j in 0..len1-1 loop
n := xmldom.item(nl, j);
e := xmldom.makeElement(n);
dbms_output.put_line(xmldom.getTagName(e) || ':');
-- get all attributes of element
nnm := xmldom.getAttributes(n);
if (xmldom.isNull(nnm) = FALSE) then
len2 := xmldom.getLength(nnm);
-- loop through attributes
for i in 0..len2-1 loop
n := xmldom.item(nnm, i);
attrname := xmldom.getNodeName(n);
attrval := xmldom.getNodeValue(n);
dbms_output.put(' ' || attrname || ' = ' || attrval);
end loop;
dbms_output.put_line('');
end if;
end loop;
end printElementAttributes;
begin
-- new parser
p := xmlparser.newParser;
-- set some characteristics
xmlparser.setValidationMode(p, FALSE);
xmlparser.setErrorLog(p, dir || '/' || errfile);
xmlparser.setBaseDir(p, dir);
-- parse input file
xmlparser.parse(p, dir || '/' || inpfile);
-- get document
doc := xmlparser.getDocument(p);
-- Print document elements
dbms_output.put('The elements are: ');
printElements(doc);
-- Print document element attributes
dbms_output.put_line('The attributes of each element are: ');
printElementAttributes(doc);
-- deal with exceptions
exception
when xmldom.INDEX_SIZE_ERR then
raise_application_error(-20120, 'Index Size error');
when xmldom.DOMSTRING_SIZE_ERR then
raise_application_error(-20120, 'String Size error');
when xmldom.HIERARCHY_REQUEST_ERR then
raise_application_error(-20120, 'Hierarchy request error');
when xmldom.WRONG_DOCUMENT_ERR then
raise_application_error(-20120, 'Wrong doc error');
when xmldom.INVALID_CHARACTER_ERR then
raise_application_error(-20120, 'Invalid Char error');
when xmldom.NO_DATA_ALLOWED_ERR then
raise_application_error(-20120, 'Nod data allowed error');
when xmldom.NO_MODIFICATION_ALLOWED_ERR then
raise_application_error(-20120, 'No mod allowed error');
when xmldom.NOT_FOUND_ERR then
raise_application_error(-20120, 'Not found error');
when xmldom.NOT_SUPPORTED_ERR then
raise_application_error(-20120, 'Not supported error');
when xmldom.INUSE_ATTRIBUTE_ERR then
raise_application_error(-20120, 'In use attr error');
end domsample;
show errors; -
Big XML document as blob in firebird database
Hi! I'm having some problems trying to use blob to store an XML document on a Firebird database. I'll try to make this simple: I'm reading a CD and copying the structure to an xml document (org.w3c.dom.Document), and i need to store it on a firebid database. The thing is that the document is really huge and when i try to insert it as text i get an exception:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544726. Error reading data from the connection.
Reason: Error reading data from the connection.
Here is the code to insert:
StringBuffer buffer = new StringBuffer();
printDOM(catalog.getXMLDom(), buffer);
new DBInsert("INSERT INTO CD (NAME, CATEGORY, CATALOG_TYPE, CATALOG_DESCRIPTION, CATALOG_UBICATION, CATALOG_FORMAT, XML) VALUES ('" + catalog.getName() + "','" + category + "','" + catalog.getCatalogType() + "','" + catalog.getCatalogDescription() + "','" + catalog.getCatalogUbication() + "','" + catalog.getCatalogFormat() + "','" + buffer.toString() + "')"); The buffer has all the xml structure which i took from the Document object, and when i read from the database it's supposed to restore the document from the xml structure.
I'd be very happy if someone gives me a clue with that :) I have no idea how to insert and how to read the blob. The database column is defined with this domain CREATE DOMAIN BXML AS
BLOB SUB_TYPE 1 SEGMENT SIZE 4096 CHARACTER SET NONE;
Thanks for your time!
Fede
Edited by: fedebobbio1 on Dec 5, 2007 6:24 PMSee the document demo for the XSQL Servlet.
If it inserts an xml document into the database as a blob. -
Heap space error while creating XML document from Resultset
I am getting Heap space error while creating XML document from Resultset.
It was working fine from small result set object but when the size of resultset was more than 25,000, heap space error
I am already using -Xms32m -Xmx1024m
Is there a way to directly write to xml file from resultset instead of creating the whole document first and then writing it to file? Code examples please?
here is my code:
stmt = conn.prepareStatement(sql);
result = stmt.executeQuery();
result.setFetchSize(999);
Document doc = JDBCUtil.toDocument(result, Application.BANK_ID, interfaceType, Application.VERSION);
JDBCUtil.write(doc, fileName);
public static Document toDocument(ResultSet rs, String bankId, String interfaceFileType, String version)
throws ParserConfigurationException, SQLException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
Element results = doc.createElement("sims");
results.setAttribute("bank", bankId);
results.setAttribute("record_type", "HEADER");
results.setAttribute("file_type", interfaceFileType);
results.setAttribute("version", version);
doc.appendChild(results);
ResultSetMetaData rsmd = rs.getMetaData();
int colCount = rsmd.getColumnCount();
String columnName="";
Object value;
while (rs.next()) {
Element row = doc.createElement("rec");
results.appendChild(row);
for (int i = 1; i <= colCount; i++) {
columnName = rsmd.getColumnLabel(i);
value = rs.getObject(i);
Element node = doc.createElement(columnName);
if(value != null)
node.appendChild(doc.createTextNode(value.toString()));
else
node.appendChild(doc.createTextNode(""));
row.appendChild(node);
return doc;
public static void write(Document document, String filename) {
//long start = System.currentTimeMillis();
// lets write to a file
OutputFormat format = new OutputFormat(document); // Serialize DOM
format.setIndent(2);
format.setLineSeparator(System.getProperty("line.separator"));
format.setLineWidth(80);
try {
FileWriter writer = new FileWriter(filename);
BufferedWriter buf = new BufferedWriter(writer);
XMLSerializer FileSerial = new XMLSerializer(writer, format);
FileSerial.asDOMSerializer(); // As a DOM Serializer
FileSerial.serialize(document);
writer.close();
} catch (IOException ioe) {
ioe.printStackTrace();
//long end = System.currentTimeMillis();
//System.err.println("W3C File write time :" + (end - start) + " " + filename);
}you can increase your heap size..... try setting this as your environment variable.....
variable: JAVA_OPTS
value: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -
Very urgent help needed- Error while passing XML document to Oracle stored
Hi !
I have been struggling a lot to call Oracle 9i stored procedure passing Stringbuilder object type from ASP.NET
I am using Visual Studio 2008 Professional, OS: Windows XP and Oracle: 9.2.0.1.0
Following is the procedure:
CREATE or REPLACE PROCEDURE loadCompanyInfo (clobxml IN clob) IS
-- Declare a CLOB variable
ciXML clob;
BEGIN
-- Store the Purchase Order XML in the CLOB variable
ciXML := clobxml;
-- Insert the Purchase Order XML into an XMLType column
INSERT INTO companyinfotbl (companyinfo) VALUES (XMLTYPE(ciXML));
commit;
--Handle the exceptions
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20101, 'Exception occurred in loadCompanyInfo procedure :'||SQLERRM);
END loadCompanyInfo ;
And following is the ASP.net code:
StringBuilder b = new StringBuilder();
b.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
b.Append("<item>");
b.Append("<price>500</price>");
b.Append("<description>some item</description>");
b.Append("<quantity>5</quantity>");
b.Append("</item>");
//Here you'll have the Xml as a string
string myXmlString1 = b.ToString();
//string result;
using (OracleConnection objConn = new OracleConnection("Data Source=testdb; User ID=testuser; Password=pwd1"))
OracleCommand objCmd = new OracleCommand();
objCmd.Connection = objConn;
objCmd.CommandText = "loadCompanyInfo";
objCmd.CommandType = CommandType.StoredProcedure;
//OracleParameter pmyXmlString1 = new OracleParameter("pmyXmlString1", new OracleString(myXmlString1));
objCmd.Parameters.Add("myXmlString1", OracleType.clob);
objCmd.Parameters.Add(myXmlString1).Direction = ParameterDirection.Input;
//objCmd.Parameters.Add("result", OracleType.VarChar).Direction = ParameterDirection.Output;
try
objConn.Open();
objCmd.ExecuteNonQuery();
catch (Exception ex)
Label1.Text = "Exception: {0}" + ex.ToString();
objConn.Close();
When I am trying to execute it, I am getting the following error:
Exception: {0}System.Data.OracleClient.OracleException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'LOADCOMPANYINFO' ORA-06550: line 1, column 7: PL/SQL: Statement ignored at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery() at Default.Button1Click(Object sender, EventArgs e)
I understand from this that the .net type is not the correct one, but I am not sure how to correct it. I could not find any proper example in any documentation that I came across. Most of the examples give information on how to read but not how to insert XML into Oracle table by calling Stored Procedure.
Can you please help me to solve this problem? I hope that you can help solve this.
Also, can you please give me an example of passing XML document XMLdocument to Oracle Stored procedure.
In both the cases, if you can provide the working code then it would be of great help.
Thanks,Hi ,
Additional to the Above error details my BPEL code looks like this:
<process name="BPELProcess1"
targetNamespace="http://xmlns.oracle.com/Application10/Project10/BPELProcess1"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:client="http://xmlns.oracle.com/Application10/Project10/BPELProcess1"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
<partnerLinks>
<partnerLink name="bpelprocess1_client" partnerLinkType="client:BPELProcess1" myRole="BPELProcess1Provider" partnerRole="BPELProcess1Requester"/>
</partnerLinks>
<variables>
<variable name="inputVariable" messageType="client:BPELProcess1RequestMessage"/>
<variable name="outputVariable" messageType="client:BPELProcess1ResponseMessage"/>
</variables>
<sequence name="main">
<receive name="receiveInput" partnerLink="bpelprocess1_client" portType="client:BPELProcess1" operation="process" variable="inputVariable" createInstance="yes"/>
<invoke name="callbackClient" partnerLink="bpelprocess1_client" portType="client:BPELProcess1Callback" operation="processResponse" inputVariable="outputVariable"/>
</sequence>
</process>
Kindly help if anyone has faced this Issue before.
Regards,
Rakshitha -
Intermedia text search in XML document stored as CLOB
Suppose i store an XML document as clob
and i index it based on the tags ie
if i have the followind table
create table biodata (
resume_id number primary key,
content clob default empty_clob(),
applicant_id number references
applicants(id));
and i stores various resumes in the clob (content column ) as xml document ie
<experience_in_months> 22 </experience_in_months>
Now if i want all the resume_id that that have experiences_in_months >= 10
what would be the query that would fetch me this result?<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by voron:
We are storing data in XML format in an Oracle database (via CLOB). I can retrieve search results using the 'within' phrase, but am finding it hard to order them. Is there a utility or command I can use?<HR></BLOCKQUOTE>
Maybe you should write a stored procedure (function )
that extracts the section from your clob
that should be sorted. Then use this function
in the ORDER clause of your select statement.
Andreas
null
Maybe you are looking for
-
Anonymous UUID: 0C3CE514-2571-E1BA-CE80-AFCB2154798F Sat Jan 10 18:44:54 2015 *** Panic Report *** panic(cpu 2 caller 0xffffff7f8b16ff63): "GPU Panic: [<None>] 5 3 7f 0 0 0 0 3 : NVRM[0/1:0:0]: Read Error 0x00000100: CFG 0xffffffff 0xffffffff 0xffff
-
Hi, While creating Payment consolidation in BP following error is raised. "Cannot concatenate summary cards [Business Partner - BP Summary], 'BPcode' [Message 3502-1] What could be the reason. Can anybody help on this. Thanks in advance Narayanan
-
Attempt to print to Acrobat from IE fails/locks up
I print from IE to Acrobat to create a PDF. Sometimes I fail to notice that the document in IE is already a PDF. When that happens, the dialog box for selecting a file name to print to comes up, but it's locked up and nothing can be entered. So far I
-
HT1386 How does the sync process work on the latest version of iTunes?
I used to be able to drag songs I wanted to sync to an iPod touch. Now I can't figure out how to do it in the latest update.
-
Select specific number of rows
i'm listing all data entries in a database. for that i want to select the 1st ten entires, then the next ten and so on ordered by date_column. how can i do that? is it possible with rownum? in mysql/php i did it with limit $query = "select * from art