How to insert folloiwng XML file in Oracle -

Hello
This is on Database 11g.
I have a very large XML file with following elements. I am new to PL SQL XML programming. How can I make Oracle read the OS file location where the XML file is located, open the XML file and insert XML data residing in their tag elements and non-tag elements ?
<BillOfMaterialItem revisionIdentifier="--" billOfMaterialItemIdentifier="645-173-1" billOfMaterialItemUniqueIdentifier="IVI123019387" itemQuantity="6" globalProductQuantityTypeCode="PerAssembly" globalProductQuantityTypeCodeOther="" notes="" description="3/8" WIDE" proprietarySequenceIdentifier="115510509">
- <AdditionalAttributes groupLabel="BOM Information">
  <AdditionalAttribute name="Line Number" value="20" dataType="Float" />
  </AdditionalAttributes>
  </BillOfMaterialItem>
{code}
Thanks,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

forum has many example
look at Re: Load xml data in Oracle table
steps:
- create oracle directory
- create table(s) for your data, may be with column xmltype
- parse xml files from oracle directory and insert into table(s)
for example
SQL> select * from v$version where rownum=1;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
SQL>
SQL> select *
  2      from (xmltable('*'
  3                     passing (xmltype(bfilename('GET_XML','sample.xml'),nls_charset_id('AL32UTF8')))
  4                     columns billofmaterialitem_revisionid varchar2(10) path '/BillOfMaterialItem/@revisionIdentifier'
  5                            , billofmaterialitem_itemid varchar2(20) path '/BillOfMaterialItem/@billOfMaterialItemIdentifier'
  6                            , BillOfMaterialItem_ItUId varchar2(20) PATH '/BillOfMaterialItem/@billOfMaterialItemUniqueIdentifier'
  7                            , billofmaterialitem_itemq varchar2(20) path '/BillOfMaterialItem/@itemQuantity'
  8                            , billofmaterialitem_gqtcode varchar2(20) path '/BillOfMaterialItem/@globalProductQuantityTypeCode'
  9                            , BillOfMaterialItem_notes varchar2(20) PATH '/BillOfMaterialItem/@notes'
10                            , BillOfMaterialItem_desc varchar2(20) PATH '/BillOfMaterialItem/@description'
11                            , billofmaterialitem_prseqid varchar2(20) path '/BillOfMaterialItem/@proprietarySequenceIdentifier'
12                            , additionalattributes_grlbl varchar2(20) path '/BillOfMaterialItem/AdditionalAttributes/@groupLabel'
13                            , additionalattribute_name varchar2(20) path '/BillOfMaterialItem/AdditionalAttributes//AdditionalAttribute/@name'
14                            , additionalattribute_value varchar2(20) path '/BillOfMaterialItem/AdditionalAttributes//AdditionalAttribute/@value'
15                            , AdditionalAttribute_dataType varchar2(20) PATH '/BillOfMaterialItem/AdditionalAttributes//AdditionalAttribute/@dataType'
16                    )
17           ) x
18  /
BILLOFMATERIALITEM_REVISIONID BILLOFMATERIALITEM_ITEMID BILLOFMATERIALITEM_ITUID BILLOFMATERIALITEM_ITEMQ BILLOFMATERIALITEM_GQTCODE BILLOFMATERIALITEM_NOTES BILLOFMATERIALITEM_DESC BILLOFMATERIALITEM_PRSEQID ADDITIONALATTRIBUTES_GRLBL ADDITIONALATTRIBUTE_NAME ADDITIONALATTRIBUTE_VALUE ADDITIONALATTRIBUTE_DATATYPE
--                            645-173-1                 IVI123019387             6                        PerAssembly                                         3/8                     115510509                  BOM Information            Line Number              20                        Float
SQL>

Similar Messages

  • How to insert an image file in Oracle database

    hi
    can you please tell me how to insert an image file into oracle database????
    suppose there is one image file in c:\pictures\rose.jpg. how to insert that file into database? theoretically i know that will be BFILE type but i dont know how to insert that.
    will be waiting for your reply........
    thanks & regards,
    Priyatosh

    Hello,
    The easiest way to load a blob is to use SQL loader.
    This example comes from the utilities guide:
    LOAD DATA
    INFILE 'sample.dat'
    INTO TABLE person_table
    FIELDS TERMINATED BY ','
    (name CHAR(20),
    1 ext_fname FILLER CHAR(40),
    2 "RESUME" LOBFILE(ext_fname) TERMINATED BY EOF)
    Datafile (sample.dat)
    Johny Quest,jqresume.txt,
    Speed Racer,'/private/sracer/srresume.txt',
    Secondary Datafile (jqresume.txt)
    Johny Quest
    500 Oracle Parkway
    Secondary Datafile (srresume.txt)
    Loading LOBs
    10-18 Oracle Database Utilities
    Speed Racer
    400 Oracle Parkway
    regards,
    Ivo

  • How to insert a image file into oracle database

    hi all
    can anyone guide me how to insert a image file into oracle database now
    i have created table using
    create table imagestore(image blob);
    but when inserting i totally lost don't know what to do how to write query to insert image file

    Hi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
    Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
    out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
    out.println("   <input type='submit' name='submit' value='Submit' class='smalltext'>");
    out.println("</form>"); Import this once you have the jar file:
    import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
    private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
            boolean result = true;
            String fileName = null;
            byte fileData[] = null;
            String fileUploadError = null;
            String imageType = "";
            String error = "";
            DiskFileUpload fb = new DiskFileUpload();
            List fileItems = fb.parseRequest(request);
            Iterator it = fileItems.iterator();
            while(it.hasNext()){
                FileItem fileItem = (FileItem)it.next();
                if (!fileItem.isFormField()) {
                    fileName = fileItem.getName();
                    fileData = fileItem.get();
                    // Get the imageType from the filename extension
                    if (fileName != null) {
                        int dotPos = fileName.indexOf('.');
                        if (dotPos >= 0 && dotPos != fileName.length()-1) {
                            imageType = fileName.substring(dotPos+1).toLowerCase();
                            if (imageType.equals("jpg")) {
                                imageType = "jpeg";
            String filePath = request.getParameter("FILE_PATH");
            session.setAttribute("filePath", filePath);
            session.setAttribute("fileData", fileData);
            session.setAttribute("fileName", fileName);
            session.setAttribute("imageType", imageType);
            return result;  
         } And now finally the method to actually write the file to the database:
    private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
            //If the previous code found a file that can be uploaded then
            //save it into the database via a pstmt
            String sql = "";
            UtilDBquery udbq = getUser(request).connectToDatabase();
            Connection con = null;
            int signatureID = 0;
            PreparedStatement pstmt = null;
            try {
                udbq.setUsePreparedStatements(true);
                con = udbq.getPooledConnection();
                con.setAutoCommit(false);
                if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
                    sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
                    pstmt = con.prepareStatement(sql);
                    ResultSet rs = pstmt.executeQuery();
                    while(rs.next()) {
                       signatureID = rs.getInt(1);
                    if (fileName != null && imageType != null) {
                        sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setInt(1, signatureID);
                        pstmt.setBinaryStream(2, is2, (int)(fileData.length));
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
                if(mode.equals("U") && signatureIDIn != 0) {
                    signatureID = signatureIDIn.intValue();
                    if (fileName != null && imageType != null) {
                        sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setBinaryStream(1, is2, (int)(fileData.length));
                        pstmt.setInt(2, signatureID);
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
            } catch (Exception e) {
                con = null;
                throw new Exception(e.toString());
            return signatureID;
       }

  • How to insert large xml file to XMLType column?

    Hi,
    I have a table with one column as XMLType(Binary XML storage option and Free Text Indexing). When i try to insert a large XML as long as 8kb, i'm getting an error ORA-01704:string literal too long.
    Insert into TEST values(XMLTYPE('xml HERE'));
    How to insert large XML values to XMLType column?
    Regards,
    Sprightee

    For a large XML file, you basically have two options - you can load the string directly as an XMLType, or you can load the string as a CLOB and cast it on the database side to an XMLType.
    If you decide to load the XML as XmlType client-side, then you may be interested to know that versions of Oracle after 11.2.0.2 support the JDBC 4.0 SQLXML standard. See the JDBC driver release documentation here:
    http://docs.oracle.com/cd/E18283_01/java.112/e16548/jdbcvers.htm#BABGHBCC
    If you want to load as a CLOB, then you'll need to use PreparedStatement's setClob() method, or allocate an oracle.sql.clob object.
    For versions before 11.2.0.2, you can create an XMLType with a constructor that includes an InputStream or byte[] array.
    HTH
    Edited by: 938186 on Jun 23, 2012 11:43 AM

  • How to export an XML file from oracle database?

    plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database?
    thanks in advance,
    Bala.
    Edited by: user3523292 on Nov 14, 2008 5:43 AM

    user3523292 wrote:
    plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database?
    thanks in advance,
    Bala.
    Edited by: user3523292 on Nov 14, 2008 5:43 AMThis is a forum of volunteers. There is no "urgent" here. Nevertheless, a google search of 'xml oracle export' quickly lead me to this Oracle site:
    otn.oracle.com/sample_code/tech/xml/index.html
    I also see lots of hits when I search the documentation library at tahiti.oracle.com for 'xml'. This one in particular may be what you are looking for:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14252/adx_j_xsu.htm#ADXDK070

  • How to insert External XML file content into XMLTYPE through Pro*c

    Could any one sugest me how to insert a external XML file content into Db
    into XMLTYPE datatype through Pro*c program.
    Thanks for any help...... who has done this
    Ghanta Tagore

    Hi
    After some good fight of 3 days, I have done it through Pro*c
    This is the way to handle this
    Buffer-->Temporary Clob-->XMLTYPE(using CreateXml)
    Pasting my piece o code to do this
    ===============
    OCIClobLocator *license_txt;
    varchar h_ttt[1024] = {'\0'};
    ub4 amt;
    int i;
    EXEC SQL ALLOCATE :license_txt;
    EXEC SQL LOB CREATE TEMPORARY :license_txt ;
    GetName(name); /*Gets Name to insert into name column in License Table*/
    for(i=0; i<4;i++)
    GetXMLL((char *)h_ttt.arr); /*Gets a string value of XML into this example*/
    /*<Tagore>Is From TCS Delhi</Tagore>*/
    /*This can be changed to get buffer from FILE */
    h_ttt.len = strlen((char *)h_ttt.arr);
    amt = sizeof(char) * h_ttt.len ;
    EXEC SQL LOB WRITE APPEND :amt FROM :h_ttt INTO :license_txt;
    EXEC SQL
    INSERT INTO license_table VALUES (:sss, :name, sys.xmltype.createXML(:license_txt))
    ================
    Thanks For ur Help
    Tagore Ghanta

  • How to insert large xml file ino xmltype column

    Hi all,
    iam using oracle10g. I have a table example1(key_column varchar2(10),xml_column xmltype) like this. i want to insert xml file from server to xmltype column. Can you please anybody suggest regarding this.wht is the size of the xmltype column. is it same as clob like 2GB or sth different. and one more thing is iam creating one procedure in that procedure , in that we are fetching xmltype value into clob varable. is it correct or not...
    Thanks

    Manipulating a single XMLType of 2GB is probably not sensible period. I'm guessing that the content of a file that big is probably a set of smaller XML documents which someone has wrapped a begin and end tag around. Since databases are good at handling collections of documents (or collections of anything else for that matter), you should consider de-compising the large document back into a set of smaller documents before storing it in the database

  • Create XML file from Oracle DB

    Hi,
    I'm working in a task to create electronic billing for Mexico Rules, to do this; I need to create a XML source that will contain all the information requested from Oracle DB.
    For this reason, I'm looking how to create this XML file from Oracle DB.
    All this is for the new legislations rules in Mexico to use electronic billing.
    Please, if you have any reference about this, let me know.
    Thanks and regards.

    you may want to check out commands like xmlforest and xmlelement
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions221.htm
    copied from documentation
    Purpose
    XMLForest converts each of its argument parameters to XML, and then returns an XML fragment that is the concatenation of these converted arguments.
    •If value_expr is a scalar expression, then you can omit the AS clause, and Oracle Database uses the column name as the element name.
    •If value_expr is an object type or collection, then the AS clause is mandatory, and Oracle uses the specified c_alias as the enclosing tag. The c_alias can be up to 4000 characters.
    •If value_expr is null, then no element is created for that value_expr.
    Examples
    The following example creates an Emp element for a subset of employees, with nested employee_id, last_name, and salary elements as the contents of Emp:
    SELECT XMLELEMENT("Emp",
    XMLFOREST(e.employee_id, e.last_name, e.salary))
    "Emp Element"
    FROM employees e WHERE employee_id = 204;
    Emp Element
    <Emp>
    <EMPLOYEE_ID>204</EMPLOYEE_ID>
    <LAST_NAME>Baer</LAST_NAME>
    <SALARY>10000</SALARY>
    </Emp>

  • Reading XML File in Oracle 10g

    Can anybody tell me How to Read an XML file into Oracle Table and update the Records.
    Please guide me.

    http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html
    or else straighter way, go here:
    XML DB
    Edited by: Ora on Feb 16, 2011 1:32 AM

  • Insert a xml file without assigning the tablename in the xmldb

    hi guys,
    here comes a interesting question,
    after I registed a xml schema in oracle xml db, oracle create several tables depending on the schema, then I want to insert a xml file that is valided with the register schema and this xml file point to the "schemaurl" .
    If its possible to insert this xml file to oracle xmldb without point out the exact table name in the java program ( in oci driver or thin driver ).
    BTW, I can copy this xml file to oracle xml db repository, oracle insert it to xml table automatically.
    Mark, would you please give me some advice ;-)
    Thanks

    You can call it from JDBC using thin or thick. Thick is preferred...
    package com.oracle.st.xmldb.pm.examples;
    import com.oracle.st.xmldb.pm.common.baseApp.BaseApplication;
    import java.io.ByteArrayInputStream;
    import java.io.InputStream;
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OracleResultSet;
    import oracle.jdbc.OracleTypes;
    import oracle.xdb.XMLType;
    public class CreateResource extends BaseApplication {
        public CreateResource() {
        public void doSomething(String[] Args) throws Exception
          OracleCallableStatement  statement = null;
          String statementText;
          statementText =
          "declare" +
          " res varchar2(5);" +
          "begin " +
          "  if (dbms_xdb.createResource(:1,:2)) then " +
          "    res := 'TRUE';" +
          "  else" +
          "    res := 'FALSE';" +
          "  end if;" +
          "  :3 := res;" +
          "end;";
          XMLType xml;
          // In the real world we would get an InputStream from something more interesting that
          // an in memeory String
          String xmlText = "<Root><Element Attr=\"AttrValue\">A text Node</Element></Root>";
          byte[] byteBuffer = xmlText.getBytes();
          InputStream is = new ByteArrayInputStream(byteBuffer);
          xml = XMLType.createXML(this.getConnection(),is);
          statement = (OracleCallableStatement) getConnection().prepareCall(statementText);
          statement.registerOutParameter(3,OracleTypes.VARCHAR);
          statement.setString(1,"/public/test1.xml");
          statement.setObject(2,xml);
          boolean res = statement.execute();
          String plsqlResult = statement.getString(3);
          System.out.println("The result is " + plsqlResult);
          statement.close();
          getConnection().commit();
          getConnection().close();
        public static void main (String[] args)
         try
           CreateResource example = new CreateResource();
           example.initializeConnection();
           example.doSomething(args);
         catch (Exception e)
           e.printStackTrace();
    }

  • How to export a data as an XML file from oracle data base?

    could u pls tell me the step by step procedure for following questions...? how to export a data as an XML file from oracle data base? is it possible? plz tell me itz urgent requirement...
    Thankz in advance
    Bala

    SQL> SELECT * FROM v$version;
    BANNER
    Oracle DATABASE 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS FOR 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    5 rows selected.
    SQL> CREATE OR REPLACE directory utldata AS 'C:\temp';
    Directory created.
    SQL> declare                                                                                                               
      2    doc  DBMS_XMLDOM.DOMDocument;                                                                                       
      3    xdata  XMLTYPE;                                                                                                     
      4                                                                                                                        
      5    CURSOR xmlcur IS                                                                                                    
      6    SELECT xmlelement("Employee",XMLAttributes('http://www.w3.org/2001/XMLSchema' AS "xmlns:xsi",                       
      7                                  'http://www.oracle.com/Employee.xsd' AS "xsi:nonamespaceSchemaLocation")              
      8                              ,xmlelement("EmployeeNumber",e.empno)                                                     
      9                              ,xmlelement("EmployeeName",e.ename)                                                       
    10                              ,xmlelement("Department",xmlelement("DepartmentName",d.dname)                             
    11                                                      ,xmlelement("Location",d.loc)                                     
    12                                         )                                                                              
    13                   )                                                                                                    
    14     FROM   emp e                                                                                                       
    15     ,      dept d                                                                                                      
    16     WHERE  e.DEPTNO=d.DEPTNO;                                                                                          
    17                                                                                                                        
    18  begin                                                                                                                 
    19    OPEN xmlcur;                                                                                                        
    20    FETCH xmlcur INTO xdata;                                                                                            
    21    CLOSE xmlcur;                                                                                                       
    22    doc := DBMS_XMLDOM.NewDOMDocument(xdata);                                                                           
    23    DBMS_XMLDOM.WRITETOFILE(doc, 'UTLDATA/marco.xml');                                                                  
    24  end;                                                                                                                  
    25  /                                                                                                                      
    PL/SQL procedure successfully completed.
    .

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • Data Load from XML file to Oracle Table

    Hi,
    I am trying to load data from XML file to Oracle table using DBMS_XMLStore utility.I have performed the prerequisites like creating the directory from APPS user, grant read/write to directory, placing the data file on folder on apps tier, created a procedure ‘insertXML’ to load the data based on metalink note (Note ID: 396573.1 How to Insert XML by passing a file Instead of using Embedded XML). I am running the procedure thru below anonymous block  to insert the data in the table.
    Anonymous block
    declare
      begin
      insertXML('XMLDIR', 'results.xml', 'employee_results');
      end;
    I am getting below error after running the anonymous block.
    Error :     ORA-22288: file or LOB operation FILEOPEN failed”
    Cause :   The operation attempted on the file or LOB failed.
    Action:   See the next error message in the error stack for more detailed
               information.  Also, verify that the file or LOB exists and that
               the necessary privileges are set for the specified operation. If
               the error still persists, report the error to the DBA.
    I searched this error on metalink and found DOC ID 1556652.1 . I Ran the script provided in the document. PFA the script.
    Also, attaching a document that list down the steps that I have followed.
    Please check and let me know if I am missing something in the process. Please help to get this resolve.
    Regards,
    Sankalp

    Thanks Bashar for your prompt response.
    I ran the insert statement but encountered error,below are the error details. statement.
    Error report -
    SQL Error: ORA-22288: file or LOB operation FILEOPEN failed
    No such file or directory
    ORA-06512: at "SYS.XMLTYPE", line 296
    ORA-06512: at line 1
    22288. 00000 -  "file or LOB operation %s failed\n%s"
    *Cause:    The operation attempted on the file or LOB failed.
    *Action:   See the next error message in the error stack for more detailed
               information.  Also, verify that the file or LOB exists and that
               the necessary privileges are set for the specified operation. If
               the error still persists, report the error to the DBA.
    INSERT statement I ran
    INSERT INTO employee_results (USERNAME,FIRSTNAME,LASTNAME,STATUS)
        SELECT *
        FROM XMLTABLE('/Results/Users/User'
               PASSING XMLTYPE(BFILENAME('XMLDIR', 'results.xml'),
               NLS_CHARSET_ID('CHAR_CS'))
               COLUMNS USERNAME  NUMBER(4)    PATH 'USERNAME',
                       FIRSTNAME  VARCHAR2(10) PATH 'FIRSTNAME',
                       LASTNAME    NUMBER(7,2)  PATH 'LASTNAME',
                       STATUS  VARCHAR2(14) PATH 'STATUS'
    Regards,
    Sankalp

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • How to delete an .xml file from xmltype table?

    Hi expert,
    I am in I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
    I have inserted 3 .xml files into an xmltype table: DOCUMENT
    SQL> SELECT OBJECT_VALUE FROM document;
    OBJECT_VALUE
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc
    ation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" classCode="DOC">
    <id root="5ca4e3cb-7298-4948-8cc2-58e71ad32694"/>
    <code code="51725-0" c
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc
    ation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" classCode="DOC">
    <id root="03d6a2cd-fdda-4fe1-865d-da0db9212f34"/>
    <code code="51725-0" c
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc
    ation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" classCode="DOC">
    <id root="09ff06d6-8b85-43dd-b5cc-e22d00f02bd0"/>
    <code code="51725-0" c
    I tried to delete one xml file which with id root="03d6a2cd-fdda-4fe1-865d-da0db9212f34'
    delete from DOCUMENT
    where xmlexists('$p/document/id[@root="03d6a2cd-fdda-4fe1-865d-da0db9212f34"]'PASSING OBJECT_VALUE AS "p");
    but failed.
    Is there any expert can help?
    Thanks a lot!
    Cow
    Edited by: Cow on Mar 11, 2011 7:02 PM

    Hi,
    Namespace issue.
    You have to declare it in the XQuery prolog :
    DELETE FROM document
    WHERE XMLExists( 'declare default element namespace "urn:hl7-org:v3"; (::)
                      $p/document/id[@root=$root_value]'
                     passing object_value as "p",
                             '03d6a2cd-fdda-4fe1-865d-da0db9212f34' as "root_value" )
    ;

Maybe you are looking for