Parsing in Oracle
Hi,
I understand hard and soft parsing but what is no parsing in Oracle. When it happens.?
Thanks.
888098 wrote:
I understand hard and soft parsing but what is no parsing in Oracle. When it happens.?When a cursor handle is reused. Consider the following examples (could be clients written in anything from Java to Cobol):
while not EOF( fileHandle ) loop
read fileRecord
cursorHandle = ParseCursor( 'insert into footab values( :1, :2 )' )
BindCursor( cursorHandle, 1, fileRecord.field1 )
BindCursor( cursorHandle, 1, fileRecord.field2 )
ExecCursor( cursorHandle )
CloseCursor( cursorHandle )
loop endThe above example parses a cursor for each loop iteration. The cursor uses bind variables and this results in a shareable SQL - which is a "good thing". The 1st parse is likely to be a hard parse. Each subsequent loop iteration is a soft parse.
However, despite the soft parsing being better than hard parsing, not parsing at all is better. The client can simply parse the SQL once and then reuse its cursor handle. E.g.
cursorHandle = ParseCursor( 'insert into footab values( :1, :2 )' )
while not EOF( fileHandle ) loop
read fileRecord
BindCursor( cursorHandle, 1, fileRecord.field1 )
BindCursor( cursorHandle, 1, fileRecord.field2 )
ExecCursor( cursorHandle )
loop end
CloseCursor( cursorHandle )In this sample code the cursor is parsed (hard or soft), once. The client then simply reuses the cursor handle in the loop. And closes the cursor handle when done. This approach is faster and results in less work for the database.
PL/SQL's optimiser also supports the above approach of reusing a cursor handle as far as I know (optimising PL/SQL code to reuse cursor handles).
The bottom line is that parsing a cursor is unavoidable. You need a hard or soft parse to create a cursor handle. However, you should not parse unnecessarily. Reuse cursor handles where possible.
Similar Messages
-
HOW TO: Use the XML parser in Oracle 8.1.7
I am trying to figure out how to use the xml parser provided in oracle 8.1.7. all i want to do is parse a xml report that is defined using a schema, and place the data into the proper tables. i am totally unfamiliar with the xml parser and how it works. i have done some reading on the subject, but seem to be getting some conflicting infromation about which utilites i need and how to invoke them. can someone please tell me what utilities i need, how to invoke them, and what i need to do to get a xml document to parse and insert to a table? I would greatly appreciate any help anybody could offer. thanks.
You can parse the XML Document with XML Parser and place the data into database using XSU(XML SQL Utility).
Both of these are included in XDK for Java at:
http://otn.oracle.com/tech/xml/xdk_java
The following document could also help:
Oracle9i XML Developer's Guide--XDK [PDF] at http://otn.oracle.com/tech/xml/doc.html -
Java +XML (SAX) Parser for Oracle 8.1.5 EE
Hi there :)
I am looking java classes for SAX to parse XML. I cannot find a valid parser, cause after downloaded from Oracle XDK for java, when i try to load this calasses i get a messages that i alot of classes connot be resolved.
If somebody have valid classes on Ora 8.1.5 please send me mail.
AdamHave i possibilities to using some javatypes in oracle java stored procedure if this class is not loaded into db?
Cause i would like to create a java stored procedure to parse and insert some data from xml. I was thinking to pass xml file name as a parameter to my java procedure.
I must use Oracle 8.1.5 with jdk 1.1.7, and the best parser for me is SAX.
Please help.
Have i possobilities to use class inside oracle, which are placed outside oracle?
Something like classpath, where can i modify value (but classpath inside oracle)? -
Problem in XML Parsing via oracle procedure...
Hi,
I wrote one oracle procedure for xml parsing.
I have one valid xml file which has "encode UTF-8". The XML file contains some comments also. While we are parsing the xml file at that time it is not parse successfully and also it is not giving any error. After the following line it is skip rest of the codes(lines).
dbms_xmlparser.parseclob(l_parser, l_clob);
At the end of the xml file there are some comments which is like "<!-- abc --> ".
When I am changing the "encode UTF-8 to ISO-88596-1" & removing the comments which wrote on bottom of the file then its working fine, but the files which we are getting from the system is contains the encode UTF-8 and we don't want to preprocess on that xml files. Even if we will do that via shell script or perl script then it will be overhead to the system and in a single stroke our system will parse more than 5k xml files, so if we will do some preprocess on it, it will take some more time approx 1-2 minutes extra.
So, If someone knows any solution of this problem, then please guide & help me on this.
My xml file structure is as follows:-
<?xml version="1.0" encoding="UTF-8"?>
<mcd xmlns:HTML="http://www.w3.org/TR/REC-xml">
<child>
<child1>32.401 V5.5</child1>
<child2>ZoneGate</child2>
</child>
<mc>
<newid>
<id>12</id>
</newid>
<mindex>
<date>20111102180000</date>
<mt>abc1</mt>
<mt>abc2</mt>
<mvalue>
<r>val_1</r>
<r>val_2</r>
</mvalue>
</mindex>
</mc>
</mcd>
<!--
ALARM STATUS
morning 10
afternoon 14
evening 18
night 22
-->
<!--
PARAM:EID = 1
PARAM:GId = 3
PARAM:GSId = 0
--!>
And my oracle procedure is as follows:-
create or replace procedure loadXMLtotable(dir_name IN varchar2, xmlfile IN varchar2) AS
-- Defining the variables
ecode NUMBER;
emesg VARCHAR2(200);
l_bfile BFILE;
l_clob CLOB;
l_dest_offset INTEGER:=1;
l_src_offset INTEGER:=1;
l_Char_set_id NUMBER := NLS_CHARSET_ID('UTF8');
l_lang_context INTEGER := dbms_lob.default_lang_ctx;
l_warning INTEGER;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl1 dbms_xmldom.DOMNodeList;
l_nl2 dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
node1 dbms_xmldom.DOMNode;
colid integer ; -- column id used for identifying which column it belongs.
l_xmltype XMLTYPE;
sub_xmltype XMLTYPE;
num_nodes number;
l_index PLS_INTEGER;
l_subIndex PLS_INTEGER;
starttime Date;
temp_datatime VARCHAR(25);
columnname varchar2(300);
columnvalue varchar2(300);
-- creating a Type which is a type of "test_hem" table RowType, which I created in SVN server
TYPE tab_type IS TABLE OF test_hem%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
-- Passing the xmlfile and virtual directory name which we gave at the time of directory creation
l_bfile := BFileName('MY_FILES', xmlfile);
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
--dbms_lob.loadFromFile(dest_lob => l_clob,
-- src_lob => l_bfile,
-- amount => dbms_lob.getLength(l_bfile));
dbms_lob.loadclobfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile),
l_dest_offset, l_src_offset, l_Char_set_id, l_lang_context, l_warning);
dbms_lob.close(l_bfile);
-- make sure implicit date conversions are performed correctly
dbms_session.set_nls('NLS_DATE_FORMAT','''YYYY-MON-DD HH24:MI:SS''');
dbms_output.put_line('Date format set');
-- Create a parser.
l_parser := dbms_xmlparser.newParser;
dbms_output.put_line('output 1');
-- Parse the document and create a new DOM document.
dbms_xmlparser.parseclob(l_parser, l_clob);
dbms_output.put_line(' passed parsing');
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_output.put_line(' passed getdocument');
-- Free resources associated with the CLOB and Parser now they are no longer needed.
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
-- Get a list of all the EMP nodes in the document using the XPATH syntax.
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/child');
-- Loop through the list and create a new record in a tble collection
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
l_n := dbms_xmldom.item(l_nl1, cur_sel);
t_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
dbms_xslprocessor.valueOf(l_n,'child1/text()',t_tab(t_tab.last).country);
-- putting the state and vendorname into the table rowtype
dbms_xslprocessor.valueOf(l_n,'child2/text()',t_tab(t_tab.last).state);
END LOOP;
-- getting the version and putting into the table rowtype
l_n := dbms_xslprocessor.selectSingleNode(dbms_xmldom.makeNode(l_doc),'//mcd/mc/newid/id');
dbms_xslprocessor.valueOf(l_n,'id/text()',t_tab(t_tab.last).id);
-- selecting the nodes whose starting tag is "mindex"
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/mc/mindex');
-- checking the total number of nodes whose starting through "mi"
num_nodes := dbms_xmldom.getLength(l_nl1);
l_index := 1;
-- For loop to iterate the nodes.
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
-- whole current node is selected and storing into the node1 variable
node1 := dbms_xmldom.item(l_nl1, cur_sel);
-- setting the xmltype as AL32UTF8
l_xmltype := xmltype(l_bfile, nls_charset_id('AL32UTF8'));
-- if selecting parent node containing the mt child node then only proceed else skip that parent node.
IF (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r') > 0) Then
-- fetch the datatime, convert it into to_date format and store it into table rowtype
temp_datatime := dbms_xslprocessor.valueOf(node1, 'date/text()');
t_tab(t_tab.last).data_time := to_char(to_date(temp_datatime, 'YYYYMmcDHH24MISS'));
l_subIndex := 1;
while (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt[' || l_subIndex || ']') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r['|| l_subIndex || ']') > 0 ) LOOP
-- getting mt and corresponging mvalue/r values
dbms_xslprocessor.valueOf(node1,'mt[' || l_subIndex || ']/text()',columnname);
dbms_xslprocessor.valueOf(node1,'mvalue/r[' || l_subIndex || ']/text()',columnvalue);
l_subIndex := l_subIndex + 1;
-- getting the column to which this mapping belongs.
select columnid into colid from abc_table where columnname=name;
CASE colid
WHEN 1 THEN t_tab(t_tab.last).col1 := columnvalue;
WHEN 2 THEN t_tab(t_tab.last).col2 := columnvalue;
WHEN 3 THEN t_tab(t_tab.last).col3 := columnvalue;
ELSE dbms_output.put_line('No column mapping for counter ' || columnname) ;
END CASE; -- end of case statement.
END LOOP;
-- Insert data into the real table from the table collection.
FORALL i IN t_tab.first .. t_tab.last
INSERT INTO test_hem VALUES t_tab(i);
END IF;
l_index := l_index + 1;
COMMIT;
END LOOP;
commit;
EXCEPTION
WHEN OTHERS THEN
ecode := SQLCODE;
emesg := SQLERRM;
dbms_output.put_line(TO_CHAR(ecode) || '-' || emesg);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;Sorry Odie,
I am new to this site as well as PL/SQL. I am giving additional details which you had mentioned in your last comments.
our Oracle Database version is "10.2.0.4.0"
The structure of target table Instrument_Details is as follows:
Create table Instrument_Details (
instrument_id Integer Primary Key,
provider_name Varchar2(32),
version_number Varchar2(32),
location_id Integer,
installation_date Date,
granularity Integer,
time_out Integer );
Note:- Here test_hem is alias of Instrument_details.
Here instrument_id is a primary key.
provider_name contains the child2 xml tag value.
version_number contains the child1 xml tag value.
location_id contains the newid/id value which is map to other table which fetching the location name corresponding to the location_id.
installation_date contains the date xml tag value.
Now we have created one mapping tables where we mapped the xml tag values "mt" with table column name means "abc1 = granularity", "abc2 = time_out" in that table.
these table column value are written under mvalue xml tag.
_Our Database Character set is_:-
NLS_CHARACTERSET WE8ISO8859P1
Now as you suggest me to format your code. I am writing the xml code and procedure code again.
My xml file structure is as follows:-
<?xml version="1.0" encoding="UTF-8"?>
<mcd xmlns:HTML="http://www.w3.org/TR/REC-xml">
<child>
<child1>32.401 V5.5</child1>
<child2>ZoneGate</child2>
</child>
<mc>
<newid>
<id>12</id>
</newid>
<mindex>
<date>20111102180000</date>
<mt>abc1</mt>
<mt>abc2</mt>
<mvalue>
<r>val_1</r> -- here val_1 and val_2 are numeric values
<r>val_2</r>
</mvalue>
</mindex>
</mc>
</mcd>
<!--
ALARM STATUS
morning 10
afternoon 14
evening 18
night 22
-->
<!--
PARAM:EID = 1
PARAM:GId = 3
PARAM:GSId = 0
--!> And my oracle procedure is as follows:-
create or replace procedure loadXMLtotable(dir_name IN varchar2, xmlfile IN varchar2) AS
-- Defining the variables
ecode NUMBER;
emesg VARCHAR2(200);
l_bfile BFILE;
l_clob CLOB;
l_dest_offset INTEGER:=1;
l_src_offset INTEGER:=1;
l_Char_set_id NUMBER := NLS_CHARSET_ID('UTF8');
l_lang_context INTEGER := dbms_lob.default_lang_ctx;
l_warning INTEGER;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl1 dbms_xmldom.DOMNodeList;
l_nl2 dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
node1 dbms_xmldom.DOMNode;
colid integer ; -- column id used for identifying which column it belongs.
l_xmltype XMLTYPE;
sub_xmltype XMLTYPE;
num_nodes number;
l_index PLS_INTEGER;
l_subIndex PLS_INTEGER;
starttime Date;
temp_datatime VARCHAR(25);
columnname varchar2(300);
columnvalue varchar2(300);
-- creating a Type which is a type of "Instrument_Details" table RowType, which I created in SVN server
TYPE tab_type IS TABLE OF Instrument_Details%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
-- Passing the xmlfile and virtual directory name which we gave at the time of directory creation
l_bfile := BFileName('MY_FILES', xmlfile);
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
--dbms_lob.loadFromFile(dest_lob => l_clob,
-- src_lob => l_bfile,
-- amount => dbms_lob.getLength(l_bfile));
dbms_lob.loadclobfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile),
l_dest_offset, l_src_offset, l_Char_set_id, l_lang_context, l_warning);
dbms_lob.close(l_bfile);
-- make sure implicit date conversions are performed correctly
dbms_session.set_nls('NLS_DATE_FORMAT','''YYYY-MON-DD HH24:MI:SS''');
dbms_output.put_line('Date format set');
-- Create a parser.
l_parser := dbms_xmlparser.newParser;
dbms_output.put_line('output 1');
-- Parse the document and create a new DOM document.
dbms_xmlparser.parseclob(l_parser, l_clob);
*-- Below lines are skipping....*
dbms_output.put_line(' passed parsing');
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_output.put_line(' passed getdocument');
-- Free resources associated with the CLOB and Parser now they are no longer needed.
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
-- Get a list of all the EMP nodes in the document using the XPATH syntax.
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/child');
-- Loop through the list and create a new record in a tble collection
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
l_n := dbms_xmldom.item(l_nl1, cur_sel);
t_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
dbms_xslprocessor.valueOf(l_n,'child1/text()',t_tab(t_tab.last).country);
-- putting the state and vendorname into the table rowtype
dbms_xslprocessor.valueOf(l_n,'child2/text()',t_tab(t_tab.last).state);
END LOOP;
-- getting the version and putting into the table rowtype
l_n := dbms_xslprocessor.selectSingleNode(dbms_xmldom.makeNode(l_doc),'//mcd/mc/newid/id');
dbms_xslprocessor.valueOf(l_n,'id/text()',t_tab(t_tab.last).id);
-- selecting the nodes whose starting tag is "mindex"
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/mc/mindex');
-- checking the total number of nodes whose starting through "mi"
num_nodes := dbms_xmldom.getLength(l_nl1);
l_index := 1;
-- For loop to iterate the nodes.
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
-- whole current node is selected and storing into the node1 variable
node1 := dbms_xmldom.item(l_nl1, cur_sel);
-- setting the xmltype as AL32UTF8
l_xmltype := xmltype(l_bfile, nls_charset_id('AL32UTF8'));
-- if selecting parent node containing the mt child node then only proceed else skip that parent node.
IF (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r') > 0) Then
-- fetch the datatime, convert it into to_date format and store it into table rowtype
temp_datatime := dbms_xslprocessor.valueOf(node1, 'date/text()');
t_tab(t_tab.last).data_time := to_char(to_date(temp_datatime, 'YYYYMmcDHH24MISS'));
l_subIndex := 1;
while (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt[' || l_subIndex || ']') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r['|| l_subIndex || ']') > 0 ) LOOP
-- getting mt and corresponging mvalue/r values
dbms_xslprocessor.valueOf(node1,'mt[' || l_subIndex || ']/text()',columnname);
dbms_xslprocessor.valueOf(node1,'mvalue/r[' || l_subIndex || ']/text()',columnvalue);
l_subIndex := l_subIndex + 1;
-- getting the column to which this mapping belongs.
select columnid into colid from abc_table where columnname=name;
CASE colid
WHEN 1 THEN t_tab(t_tab.last).col1 := columnvalue;
WHEN 2 THEN t_tab(t_tab.last).col2 := columnvalue;
WHEN 3 THEN t_tab(t_tab.last).col3 := columnvalue;
ELSE dbms_output.put_line('No column mapping for counter ' || columnname) ;
END CASE; -- end of case statement.
END LOOP;
-- Insert data into the real table from the table collection.
FORALL i IN t_tab.first .. t_tab.last
INSERT INTO test_hem VALUES t_tab(i);
END IF;
l_index := l_index + 1;
COMMIT;
END LOOP;
commit;
EXCEPTION
WHEN OTHERS THEN
ecode := SQLCODE;
emesg := SQLERRM;
dbms_output.put_line(TO_CHAR(ecode) || '-' || emesg);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;Thanks in advance for your help... -
Hello all,
I'm using the below database.
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
I have a XML and I have to parse this and I need to store it in table.
Please give solution to parse.
<?xml version="1.0" encoding="UTF-8"?>
<data>
<passengerinformation>
<passengerno>0001</passengerno>
<title>Mr</title>
<firstname>Test First Name</firstname>
<familyname>family name</familyname>
<email>[email protected]</email>
<country>India</country>
<contacttype>Mobile : +91 465465487979</contacttype>
</passengerinformation>
<bookinginformation>
<bookingreferencenumber>FA45454</bookingreferencenumber>
<vehicleno>AW123</vehicleno>
<origin>Chennai</origin>
<destination>Delhi</destination>
<departuredate>24 Jun 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
<bookinginformation>
<bookingreferencenumber>ER12345</bookingreferencenumber>
<vehicleno>AW124</vehicleno>
<origin>Chennai</origin>
<destination>Noida</destination>
<departuredate>24 May 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
<bookinginformation>
<bookingreferencenumber>FA45454</bookingreferencenumber>
<vehicleno>AW125</vehicleno>
<origin>Chennai</origin>
<destination>Mumbai</destination>
<departuredate>24 Jul 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
<bookinginformation>
<bookingreferencenumber>FA45454</bookingreferencenumber>
<vehicleno>AW126</vehicleno>
<origin>Chennai</origin>
<destination>Hyd</destination>
<departuredate>24 Aug 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
</data>To give you a starting point
with xmldata as (
select xmlparse (document
'<?xml version="1.0" encoding="UTF-8"?>
<data>
<passengerinformation>
<passengerno>0001</passengerno>
<title>Mr</title>
<firstname>Test First Name</firstname>
<familyname>family name</familyname>
<email>[email protected]</email>
<country>India</country>
<contacttype>Mobile : +91 465465487979</contacttype>
</passengerinformation>
<bookinginformation>
<bookingreferencenumber>FA45454</bookingreferencenumber>
<vehicleno>AW123</vehicleno>
<origin>Chennai</origin>
<destination>Delhi</destination>
<departuredate>24 Jun 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
<bookinginformation>
<bookingreferencenumber>ER12345</bookingreferencenumber>
<vehicleno>AW124</vehicleno>
<origin>Chennai</origin>
<destination>Noida</destination>
<departuredate>24 May 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
<bookinginformation>
<bookingreferencenumber>FA45454</bookingreferencenumber>
<vehicleno>AW125</vehicleno>
<origin>Chennai</origin>
<destination>Mumbai</destination>
<departuredate>24 Jul 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
<bookinginformation>
<bookingreferencenumber>FA45454</bookingreferencenumber>
<vehicleno>AW126</vehicleno>
<origin>Chennai</origin>
<destination>Hyd</destination>
<departuredate>24 Aug 13</departuredate>
<classoftravel>Sleeper</classoftravel>
<complaintcategory>baggagedelivery</complaintcategory>
<comments>Test</comments>
</bookinginformation>
</data>') x from dual)
select
passengerno
from xmldata, xmltable( '/data/passengerinformation' passing xmldata.x
columns
passengerno varchar2(30) path 'passengerno'
PASSENGERNO
0001 -
XML Parsing in Oracle 11.2.0.3 SE edition.
Hi all,
Previously we were using Oracle 11.2.0.1 SE edition which is now upgraded to 11.2.0.3 SE. Is there any difference in the XML parsing between both these versions ?The code for parsing is as below:-
import oracle.xml.parser.schema.*;
import oracle.xml.parser.v2.*;
import oracle.sql.CHAR;
import java.io.*;
import java.sql.*;
import oracle.jdbc.OracleDriver;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
// Parse the input XML document with Schema Validation
in = new FileReader(path + "/" + filename);
SAXParser sp = new SAXParser();
sp.setXMLSchema(schemadoc);
sp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
sp.setPreserveWhitespace(true);
sp.setContentHandler(new gnvprdppetimport(filename, ratingImportId, billingImportId, productImportId));
sp.parse(in);
The insert statement statement is as below
private static void createImport(String type, String importId, String filename, String minEdit, String maxEdit, String siteID, String siteName, String catalogueID, String catalogueName, String userID, String invoicingCompanyID, String invoicingCompanyName, String currencyCode, String currencyName)
throws Exception {
if (type == "RATING") {insert("ratingimport",new String[]
{"ratingimport_id", "geneva_user_ora", "import_dtm", "file_name", "ratingedit_min_num", "ratingedit_max_num", "export_site_id", "export_site_name", "exp_rating_catalogue_id", "exp_rating_catalogue_name", "export_geneva_user_ora", "export_invoicing_co_id", "export_invoicing_co_name", "export_currency_code", "export_currency_name", "ratingconflict_boo"},
new String[] {importId, getUserId(), getSystemDate(), filename, minEdit, maxEdit, siteID, siteName, catalogueID, catalogueName, userID, invoicingCompanyID, invoicingCompanyName, currencyCode, currencyName, "T"});
} -
SAX Parser for Oracle 8.1.5
I need SAX parser - i want load this class into DB. Any ideas?
AdamHave i possibilities to using some javatypes in oracle java stored procedure if this class is not loaded into db?
Cause i would like to create a java stored procedure to parse and insert some data from xml. I was thinking to pass xml file name as a parameter to my java procedure.
I must use Oracle 8.1.5 with jdk 1.1.7, and the best parser for me is SAX.
Please help.
Have i possobilities to use class inside oracle, which are placed outside oracle?
Something like classpath, where can i modify value (but classpath inside oracle)? -
XML PL/SQL parser on Oracle 8.1.6
I am trying to loadjava xmlparserv2.jar and plsql.jar . Receiving the following errors .
What is the issue ?
$ loadjava -user drug/drug -r -v plsql.jar
initialization complete
loading : oracle/xml/parser/plsql/XMLDOMImplCover
creating : oracle/xml/parser/plsql/XMLDOMImplCover
Error while retrieving errors for oracle/xml/parser/plsql/XMLDOMImplCover
ORA-00904: invalid column name
loading : oracle/xml/parser/plsql/XMLDocumentCover
creating : oracle/xml/parser/plsql/XMLDocumentCover
Error while retrieving errors for oracle/xml/parser/plsql/XMLDocumentCover
ORA-00904: invalid column name
loading : oracle/xml/parser/plsql/XSLStylesheetCover
creating : oracle/xml/parser/plsql/XSLStylesheetCover
Error while retrieving errors for oracle/xml/parser/plsql/XSLStylesheetCover
ORA-00904: invalid column name
loading : oracle/xml/parser/plsql/XMLNodeListCover
creating : oracle/xml/parser/plsql/XMLNodeListCover
Error while retrieving errors for oracle/xml/parser/plsql/XMLNodeListCover
ORA-00904: invalid column name
loading : oracle/xml/parser/plsql/XMLEntityCover
creating : oracle/xml/parser/plsql/XMLEntityCover
Error while retrieving errors for oracle/xml/parser/plsql/XMLEntityCover
ORA-00904: invalid column name
loading : oracle/xml/parser/plsql/XMLNodeCover
creating : oracle/xml/parser/plsql/XMLNodeCover
Error while retrieving errors for oracle/xml/parser/plsql/XMLNodeCover
ORA-00904: invalid column name
I appreciate any help to resolve these issues
Sree
nullThese errors were due to not running initjvm etc. I have resolved all the jvm sqlj related problems now .
I am still seeing resolver errors . Opened a new thread for those errors.
Please respond on those
Thanks
null -
I have to parse a validated xml message into oracle database tables.
I have tried using it with DTD validation but somehow it is not working. Can anyone pls suggest me the solution to parse a validated xml message into the database tables.I have to parse a validated xml message into oracle database tables.
I have tried using it with DTD validation but somehow it is not working. Can anyone pls suggest me the solution to parse a validated xml message into the database tables. -
Hello,
I am newbe in Oracle SQL.I need help in parsing Strings.
Example:
ID Name Address num
1 Peter 123 park st,223 park st 123,223
Answer
ID Name Address num
1 Peter 123 park st 123
1 Peter 223 Park St 223
Please Help me.
Thanks.Hi,
If you're using Oracle 10.1 or higher, regular exprssions can help a lot.
Whatever version of Oracle you're using, this will probably be easier in PL/SQL. You can write a Pipelined Function that takes a string such as '1 Peter 123 park st,223 park st 123,223' as input, and returns a variable number of rows (depending on what is in the input string), like this:
ID Name Address num
1 Peter 123 park st 123
1 Peter 223 Park St 223You probably want some other functions, too, such as a tokenizer, which divides a delimited sting into parts.
As in any programming task, start by specifying exactly what you want to do. For example
"An input string s consists of +words+ , that is, sub-strings that do not contain spaces, tabs or commas.
S can contain 0 or more addresses.
The first word of s (that is, the sub-string before the first space or tab) is the id. All addresses from the same string will have the same id.
The second word of s is the name. All addresses from the same string will have the same name. If there is no 2nd word ...
After the name, s is divided into addresses by commas.
The first word of each section is the num. This same sub-string is therefore found in 2 columns of the output: address and num.
If the address consists only of 1 word, then it is ignored."
Depending on what your requirements are, this problem can be very complicated. Be prepared.
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Explain, using specific examples, how you get those results from that data.
In the sample data and results, include special cases and problems that you might encounter. For example,
some streets have numbers for names, so you might see '123 45 st' as an address. What if your sting is '1 Peter 45 st'. Is num=45? Can the name be more that 1 word, e.g. '2 Mary Ann 17 Main St'?
Always say which version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002}
Edited by: Frank Kulash on Sep 17, 2012 2:50 PM -
Resume parsing in oracle iRecruitment
Hi All
I am new to iRecruitment module i would be really thankfull if any one helps me.
Regarding the resume parsing i know that managers or recruiters can search for resumes through Resume keword search does oracle provides minimum functionality for that or that works only if any third party tool is enabled.I have actually tried with searching some resumes through Resume keword search from manager/recruiter responsibilities but its not picking those resumes.
Is there any profile options or setups are needed to make it work.
Please help me in this.Thank youHi, Dear ALL:
My HR Staffing group now is also looking for an effective resume parsing alternative. Searching thru metalink, I did not get any answer. Looking into your discussion forum, I have a few comments and questions:
(1) As far as I could have experimented, Oracle's keyword search functionality in iRecruitment does not allow you to search on the resumes' contents. I tried it but it did not work. We do have the Index Synchronization concurrent program scheduled running. The regular keyword search works, but it does not alllow us to do "Resume" search. Could sombody who knows kindly comment on this or shed some lights ?
(2) I tried to contact Resume Mirror sales team, so far I have not heard from anybody. Did anybody go thru an implementation with them and can shed some lights about how much is the implementation cost and how long does it take etc.? From the cost benefit point of view, is it worth the efforts and costs?
(3) Does anybody know how to impelement a "Boolean Search" functionality via Oracle Text? Could anybody kindly shed some light on where to find proper documentation to have it set up properly so that we can just use it via iRecruitment Candidate Search web page? If this functionality can be turned on, how is this compared with Resume Mirror's search funtionality?
Your kind assistance or input on these would be greatly appreciated. Thanks so much.
Sincerely,
Christie -
I would like to use XMLparser for plsql in Oracle 8i. I know that I can download the parser from the OTN. Can anyone tell me how to install it to Oracle8i? or does Oracle 8i DBMS already has one installed/embedded into it as the default DBMS.
Furthermore, the directions in OTN tells us to install JKD1.1.x or above and GNUgzip?
Why do I have to install JDK to use the parser? and what is GNU gzip?
Thank you very much
BenThere is a readme file in that package which
show you how to install it into your Oracle8i
database.
Duy -
Is There An XML Schema Parser From Oracle ?
Is XML parser available from oracle different from Xml Schema parser ? Is schema parser available at all ? Where can I download it ? I tried a brief search and could not find ?
Help appreciated.
Thanx
SooryaThank you. I got it. I am trying to validate against an existing schema. But it always enters the "XMLParseException" handler.
Could you direct me to the documents which gives some examples ? or a 3 lines to validate would be helpful.
Thanx again.
Soorya
null -
User-defined XML parser in Oracle
Is it possible to define our own XML parser and XSD in Oracle database?
Thanks in advance.Is it possible to define our own XML parser and XSD in Oracle database?
Thanks in advance. -
Hello Oracle Experts
I need help in seperating the numeric and alpha parts in the street name of the address as shown below.
My Oracle Version is
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Please help me in parsing the same.
5811WIPPRECHTAPT3
25742SE31STPL
2834TALLOAKTRAIL
1500SE14THST
The output I am expecting is
5811 W IPPRECHT APT 3
25742 SE 31ST PL
2834 TALLOAK TRAIL
1500 SE 14TH ST
If Number is suffixed by TH then no parsing is required as example 4.
I would appreciate any lead in this matter.
regards
RajeshOk, not that much more complicated...
SQL> ed
Wrote file afiedt.buf
1 with t as (select '5811WIPPRECHTAPT3' as addr from dual union all
2 select '25742SE31STPL' from dual union all
3 select '2834TALLOAKTRAIL' from dual union all
4 select '1500SE14THST' from dual)
5 --
6 -- end of test data
7 --
8 select addr
9 ,regexp_replace(regexp_replace(
10 regexp_replace(addr,'^([0-9]+)(NW|NE|SW|SE|N|S|W|E)?([A-Z]+)?([0-9]+(ST|RD|TH)?)?([A-Z]+)?$','\1 \2 \3 \4 \6')
11 ,' +',' '),'(APT|TRAIL) ',' \1 ') as new_addr
12* from t
SQL> /
ADDR NEW_ADDR
5811WIPPRECHTAPT3 5811 W IPPRECHT APT 3
25742SE31STPL 25742 SE 31ST PL
2834TALLOAKTRAIL 2834 TALLOAK TRAIL
1500SE14THST 1500 SE 14TH ST
SQL>but I'm sure you'll have a lot more different words that would need splitting off than just APT and TRAIL....
; )
Maybe you are looking for
-
Problems with audacity, audacious (ffmpeg libavformat.so)
Hi all, I have this problem with audacious: it can't play mpc files (and maybe other formats) since it has an error with arch's current ffmpeg setup (everything is up-to-date here). The error message it spits out is "ffaudio: Unsupported audio format
-
Where is the best place to get/read information on the pros and cons of updating my OS from Snow Leopard to the current OS? I have an iMac 27" intel, purchased Nov 2009. I am currently using 10.6.8
-
Getting a Font Error when opening a pdf file with Adobe Reader. All the newest versions of Reader, OSX etc. The error says missing font Univers-Light Sometimes Reader crashes. It turns out this is an Adobe font that I have to pay for???
-
Status Icon in Dialog Programming
hi all, Can any one tell me how to use status icons in dialogprogram?? never used it before. thanks
-
So mad - made my 1st app purchase that cost $$ and was not given the option of using my gift card. can I change this or is it a 'done deal' and my cr card will be charged??