All SAP MM related tables

Hi Sap gurus,
Please let me know all tables related to SAP Material master.
and how to get this.
Thanks,
Shayan

hi,
Here are the list of MM tables:
Materials
MARA - Material Master: General data
MAKT - Material Master: Description
MARM - Material Master: Unit of Measure
MAPE - Material master: Export control file
MARC - Material master: Plant data
MARD - Material master: Storage location
MAST - Material link to BOM
MBEW - Material valuation
MLGN u2013 Material Master: WM Inventory
MLGT u2013 Material Master: WM Inventory type
MDIP - Material: MRP profiles (field contents)
MKOP - Consignment price segment (old versions of SAP)
EBEW - Valuation of sales order stock
QBEW - Valuation of project stock
MVER u2013 Material Master: Consumption <Plant>
DVER u2013 Material Master: Consumption <MRP Area>
MVKE u2013 Material Master: Sales <Sales Org, Distr Ch>
MLAN - Material Master: Tax indicator
MARC - Material Master: Plant data
MAPR u2013 Material Master: Forecast
MARD u2013 Material Master: Storage Location
MCH1 u2013 Material Master: X Plant Batches
MCHA u2013 Material Master: Batches
MCHB u2013 Material Master: Batch Stock
MDMA - MRP Area data
DBVM - MRP Planning File Entry: MRP Area
MOFF - Outstanding Material Master Records (Maintenance status)
MARCH - Material Master C Segment: History
MARDH - Material Master Storage Location Segment: History
MBEWH - Material Valuation: History
MCHBH - Batch Stocks: History
MKOLH - Special Stocks from Vendor: History
MSCAH - Sales Order Stock at Vendor: History
MSKAH - Sales Order Stock: History
MSKUH - Special Stocks at Customer: History
MSLBH - Special Stocks at Vendor: History
MSPRH - Project Stock: History
MSSAH - Total Sales Order Stocks: History
MSSQH - Total Project Stocks: History
Vendors
LFA1 - Vendor Master: General data
LFB1 - Vendor Master: Company data
LFM1 - Vendor Master: Purchasing Data (Purchasing organization)
LFM2 - Vendor Master: Purchasing Data (Plant, Vendor sub-range)
Purchasing
EBAN - Purchase requisition: items
EBKN - Purchase Requisition: account assignment
STXH - SAPScript Text Header
STXL - SAPScript Text Lines
EKKO - Purchasing document header
EKPO - Purchasing Document: Item
EKET - Purchasing Document: Delivery Schedules
MDBS - Material View of Order Item/Schedule Line (good to find open PO's)
EKKN - Account assignment in purchasing document
EORD - Purchasing Source List
EIPA - Order price history record
EKAB - Release documentation
EKBE - Purchasing document history
EKBZ - Purchasing document history: delivery costs
EKPB - "Material to be provided" item in purchasing document
ESKL - Account assignment specification for service line
ESKN - Account assignment in service package
ESLH - Service package header data
ESLL - Lines in service package
ESSR - Service entry sheet header data
ESUC - External services management: Unplanned limits for contract item
ESUH - External services management: unplanned service limits header data
ESUP - External services management: unplanned limits for service packages
ESUS - External services management: Unplanned limits for service types
EINA - Purchase Info Record: General
EINE - Purchasing info record: purchasing organization data
KONP - Condition Item
KONH - Condition Header
Inventory Management
ISEG - Physical inventory document items
MKPF - Material document: Header
MSEG - Material document: item
RKPF - Reservation: Header
RESB - Reservation: Item
Invoice Verification
BSIM - Secondary index: documents for material
MYMFT - FIFO results table
MYML - LIFO material layer
MYMLM - LIFO material layer (monthly)
MYMP - LIFO period stocks, single material
MYMP1 - Receipt data LIFO/FIFO valuation
MYPL - LIFO pool layer
MYPLM - LIFO pool layer (monthly)
RBCO - Document item, incoming invoice account assignment
RBDIFFKO - Invoice Verification: conditions
RBDIFFME - Invoice Verification: quantity differences
RBDRSEG - Invoice Verification batch: invoice document items
RBKP - Document header: incoming invoice
RBKPB - Invoice document header (batch invoice verification)
RBTX - Taxes:incoming invoice
RBVD - Invoice document: summarization data
RBVDMAT - Invoice Verification: summarization data, material
RBWT - Withholding tax:incoming invoice
RKWA - Consignment withdrawals
RSEG - Document item, incoming invoice
Customising and other master data
MDLV - MRP Areas
MDLG - MRP Areas - Storage Locations
MDLW - MRP Areas - Plants
MDLL - MRP Areas - Subcontractor
T023 - Material Groups
T024 - Purchasing groups
T030 - Standard Accounts Table (Automatic Account Determination)
T156 - Movement Type
T156T - Movement Type: Text
AUSP - Release Procedure: Strategy values (cl20n, cl24n)
AGR_USERS - Assignment of roles to users
CDHDR & CDPOS - Change history of master data and documents
EDID4 - EDI information
TSTC - SAP Transaction Codes, lock/unlock: sm01, created: se93
TSTCT - Transaction codes TEXT
NAST - Message status
regards
Manish Joshi

Similar Messages

  • How to download the all sap bo related notes..

    Hi,
    Can anybody let me know, how can I download the all SAP BO related SAP notes.
    Thanks,
    Gana

    Hi,
    Go to the below link,
    [https://websmp110.sap-ag.de/support]
    Select the application area BI and click on Search, you will find all the notes related with BO.
    Please check and revert.
    Thanks
    Hrishi

  • How to trigger a 'delete' across different related tables in ABAP?

    Hello All,
    I am creating database tables for storing different values of features coming under different countries. I have eight tables in my design and there are fields repeating in different tables, which i am connecting through foreign key relationship.
    After entering values to all my tables, if i need to delete a particular field value which is repeating in more than two tables, is it possible to trigger a delete event by which if am deleting the field value in a particular table, all the related field values also get deleted from the respective tables?
    For example, if i have a PRODUCT field in three tables, and if one of the PRODUCT is deleted from a particular table, can i trigger a delete event by which i can delete all the values related to that particular PRODUCT from all the related tables? The PRODUCT is a primary keyfield, and i have maintained proper foreign key relations also.
    I have tried deleting entries using the views and using the database table itself, but only that particular table value is being deleted.
    Is there any function module for triggering a delete?
    Can anyone help me with some solution?Sample code will be helpful.
    Thanks in Advance,
    Shino

    Hi,
    My friend it is not advisable to delete any field from a database  table bcoz it's creats incosistance data for all the other related tables, but there r few Function Modules that provide u this functionality.
    Such As:
    G_REPORT_DELETE_ADDFLD_ENTRY
    G_CATT_DELETE_TABLE_ENTRY
    RKE_DELETE_FIELDS_FROM_TABLE
    Regards

  • What is the table to get the all planned orders related to a sale order

    Hi,
    May i know what is the table to get the all planned orders related to a sale order. My scenario is make to order scenario. we can get my out put final product by completing the nearly 916 planned orders.(Like major assemble,sub assemble). From this scenario i want the total orders related to a sale order. ( The planned orders from sale order to sale order will change. i.e 1 sale order will have 916 planned orders and one sale orders will generate 920 like that will chage when running mrp.). Now i want to pick the total planned orders for a sale order in a report. please guide me.
    Regards,
    Mastan.

    Hi,
    Use the table PLAF... in this table pass the sale order no in the filed KDAUF and then execute...issue here is once the planned orders are converted production orders, these planned orders are deleted from the system....so you will not able to see them.....
    Thanks
    Kumar

  • How to see all the data base tables in sap

    hi all,
    i wanted to see the table ALBTCMON but i cannot and i want to know how to activate a table?
    thanks for your time
    chandu

    Hai,
    Why do you want to create a Table?
    More over the table ALBTCMON you have mentioned should not be created because SAP allows only Tables with names starting with 'Y' or 'Z'.
    Also you should know the fields, Developement class, etc., before creating the Table in SAP.
    Please check the below link to create Table in SAP.
    http://abaplovers.blogspot.com/2008/02/creating-table-in-sap.html
    Use Tcode SE11 to activate your table.
    Regards,
    Yoganand.V
    Edited by: Yoganand Vedagiri on Dec 29, 2008 12:15 PM

  • Delete user and all his related data form the relation table

    HI All,
    I have user and for the user i have 3 more tables with additional fields that relate to the user
    the the user is a key on the 3 tables and relate with foreign key .
    in case i want to delete the user and i want that all the user data from all the related table will be deleted how can i do that ?
    Regards
    Joy

    HI,
    The user is in Z DB tables so i cant delete it with this bapi,
    The problem is when i have 4 table and i want to delete the user from them like that :
      DELETE FROM: (sv_user_table_name) WHERE userid = iv_user_id,
                   (sv_add_fld_table_name) WHERE userid = iv_user_id,
                   (sv_att_table_name) WHERE userid = iv_user_id,
                   (sv_app_attributes_table_name) WHERE userid = iv_user_id.
    IF sy-subrc <> 0.
        RAISE EXCEPTION TYPE .....
    if the user are exist in the first and the second table and not in the third and four
    i get the sy-subrc = 4 despite the user has deleted from the first and seconed tables
    there is nice way to overcome this issue ?
    Regards
    Joy
    Edited by: Joy Stpr on Aug 3, 2009 8:57 AM

  • FI Reports using ABAP and their Related Tables

    Hi can anyone tell me some of the commonly developed reports from FI using ABAP and their related Tables.
    Thank You

    You can find the details about the FI module here
    http://www.sap-img.com/sap-fi.htm
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • Get all sap users based on company code

    Hi,
    In my workflow i need an activity which will popup all sap users based on the company code. can anyone guide me by giving the table which is having relationship between sap user and company code. Any direct relation or indirect relation?
    Thanks
    sheron

    Hi Arghadip,
    Actually the tables u were mentioning were HR Tables right.
    But these tables are not maintained in this project. This is an SAP-ISU project.
    regards
    sheron

  • Workflow related tables. Urgent. Please help.

    Hi all,
        Could anybody please give me the list of workflow related tables ? I need to retrieve the following details.
               Type,
               Workflow Item ID,
               Workflow Item Unique ID, Text
               Creator, Created Date and Time,
               User created WI,
               Technical Status,
               Agent,
               Task ID, Task ID text,
               Element, Element Value.
    Please let me know at the earliest. Thanks in advance.

    <i>I don't think this is the right place for this, but I will give one reply.</i>
    <i>>What you think when a person is facing some issue will first read guidelines and then post.</i>
    Here is the <a href="https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement">link</a> to the guidelines. It is expected somebody first reads the guidelines and then starts posting, it is the first line in the guidelines. So I expect it also. I don't see why I should expect it from someone who has at least 30 points, and not from someone who has never posted.
    About your analogy, it doesn't work because most of the time the functional consultant needs me to create the workflow, or he is part of the same project so we need each other. In this forum I spend my own precious time answering questions, and not for the points but because I want to contribute and help others. But I expect them to have tried to 'help' themselves first.
    And as long as there is no moderator for the forum I will try to point people at the guidelines so this forum will not end up generating a lot of 'noise' and running of those who can help maybe the most (to name two: Kjetil Kilhavn and Mike Pokraka). I know they are thinking about skipping this forum because of the noise.
    <i>> Try to be a bit pragmatic. Will you do this to your peers or your junior.</i>
    Depending on the situation I will do this to my peers and juniors, mostly because they will learn more from finding things out by themselves than from pre cooked answers. And learning is one of the main objectives here.
    And my remark about the points is because you keep asking for them.
    I hope this clarifies a little why I post answers like the one I gave to this somewhat lazy question (not the first one today).
    Martin

  • Insert into sap r/3 table

    hi,guruvulu
    this is the program...............to insert the data into sap r/3 table
    but record is not inserting....any commit i have to write in my program?
    Created on Feb 20, 2007
    TODO To change the template for this generated file go to
    Window - Preferences - Java - Code Style - Code Templates
    package comm;
    @author sapusr006
    TODO To change the template for this generated type comment go to
    Window - Preferences - Java - Code Style - Code Templates
    Example2.java
    Property of SAP AG, Walldorf
    (c) Copyright SAP AG, Walldorf, 2000-2005.
    All rights reserved.
    //import java.sql.Connection;
    //import java.sql.PreparedStatement;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.IRepository;
    import com.sap.mw.jco.JCO;
    @version 1.0
    @author  SAP AG, Walldorf
    public class Fm {
      // The MySAP.com system we gonna be using
         static final String SID = "R3";
    // static String query="insert into BAPI_COMPANYCODE_GETLIST values(?,?)";
      // The repository we will be using
      IRepository repository;
                                 //ESTABLISHING A CONNECTION TO SAP
      public Fm()
        try {
          JCO.addClientPool( SID,            // Alias for this pool
                             10,             // Max. number of connections
                             "800",          // SAP client
                             "RFCTEST",      // userid
                             "welcome",      // password
                             "EN",           // language
                             "10.10.88.170", // host name
                             "01" );
           //   Create a new repository
          //    The repository caches the function and structure definitions
          //    to be used for all calls to the system SID. The creation of
          //    redundant instances cause performance and memory waste.
            repository = JCO.createRepository("MYRepository", SID);
        catch (JCO.Exception ex) {
          System.out.println("Caught an exception: \n" + ex);
                               // RETRIEVES AND DISPLAY A  ZHR INFOTYPE OPERATION
      public void salesOrders()
        JCO.Client client = null;
        try {
          // Get a function template from the repository
             //System.out.println("goes to sales order");
          IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZHR_INFOTYPE_OPERATION");
          System.out.println("hai");
               if(ftemplate != null) {
            // Create a function from the template
           JCO.Function function = ftemplate.getFunction();
           JCO.ParameterList paralist=function.getImportParameterList();
                             paralist.setValue("0000000011","PERNR");
                             paralist.setValue("UPD","ACTIO");
                             paralist.setValue("A","TCLAS");
                             System.out.println("hello");
                             paralist.setValue("20061215","BEGDA");
                             System.out.println("hello");
                             paralist.setValue("20061215","ENDDA");
                             paralist.setValue("1","OBJPS");
                             paralist.setValue("LTA","SUBTY");
              System.out.println("SETTING VALUES");
            // Get a client from the pool
              client = JCO.getClient(SID);
              System.out.println("goes to sales order");
              //function.getImportParameterList().setValue("QUERY_TABLE","ZHRJ2EETEST");
                //EXECUTING THE FUNCTION
               client.execute(function);
              System.out.println("after exeucting the function");
                 // NO OF IMPORT PARAMS IT DISPLAY
                             //STRUCTURE
                              JCO.Structure returnStructure =
                                                                              function.getExportParameterList().getStructure("RETURN");
                              String structure=returnStructure.toString();
                              System.out.println(structure);
                                                                                    JCO.Table sales_orders = function.getTableParameterList().getTable("PROPOSED_VALUES");
                             System.out.println("after function");
                               System.out.println("proposed111"+sales_orders.getNumRows());
                                                                                    sales_orders.firstRow();
                                    sales_orders.appendRows(3);
                                 sales_orders.setValue("0582","INFTY");
                                 sales_orders.setValue("P0582-AMTEX","FNAME");
                                  sales_orders.setValue("200.00","FVAL");
                                  sales_orders.nextRow();
                                  sales_orders.setValue("0582","INFTY");
                                  sales_orders.setValue("P0582-JBGDT","FNAME");
                                  sales_orders.setValue("20061215","FVAL");
                                  sales_orders.nextRow();
                                  sales_orders.setValue("0582","INFTY");
                                  sales_orders.setValue("P0582-JENDT","FNAME");
                                  sales_orders.setValue("20061215","FVAL");
                                  System.out.println("proposed222"+sales_orders.getNumRows());
                                                                                    /*for (int i = 0; i <sales_orders.getNumRows(); i++) {
                                  sales_orders.setRow(i);
                                  System.out.println(sales_orders.getString("INFTY"));
                     JCO.Table sales_orders1 = function.getTableParameterList().getTable("MODIFIED_KEYS");
                             System.out.println("modified"+sales_orders1.getNumRows());
                                                                                    sales_orders1.setRow(1);
                               sales_orders1.appendRows(1);
                               sales_orders1.setValue("0000000011","PERNR");
                               sales_orders1.setValue("0582","INFTY");
                               sales_orders1.setValue("LTA","SUBTY");
                               sales_orders1.setValue("1","OBJPS");
                               sales_orders1.setValue("20061215","BEGDA");
                               sales_orders1.setValue("20061215","ENDDA");
                             System.out.println("modified222"+sales_orders1.getNumRows());
                                                                                    System.out.println("execute222"+sales_orders1.getNumRows());
                                                                                    for (int i = 0; i <sales_orders1.getNumRows(); i++) {
                                  sales_orders.setRow(i);
                                  System.out.println("hia"+sales_orders1.getString("SUBTY"));
                                                                                    System.out.println("NO OF ROWS ARE:---"+ sales_orders.getNumRows());
               String fieldName[]=new String[sales_orders.getFieldCount()];
               System.out.println("THE COLUMNS IN THE TABLE ARE:--"+sales_orders.getFieldCount());
               // sales_orders.firstRow();
               //COLUMNS NAMES
               System.out.println(fieldName.length);
               for (int iCtrst = 0;iCtrst < sales_orders1.getFieldCount();iCtrst++) {
                        fieldName[iCtrst] = sales_orders1.getName(iCtrst);
                        System.out.println(fieldName[iCtrst]);
            if (sales_orders.getNumRows() > 0) {
              // Loop over all rows
               do {
                     System.out.println("----
                     //int r=1;
                // Loop over all columns in the current row
                for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements();)
                       JCO.Field field = e.nextField();
                       String compcode=field.getString();
                       //pst.setString(r,compcode);
                       System.out.println(field.getName() + ":\t" + field.getString());
                      // r++;
                   }//for
                    // i=pst.executeUpdate();
                } while(sales_orders.nextRow());
            else {
              System.out.println("No results found");
            if (sales_orders1.getNumRows() > 0) {
                // Loop over all rows
                 do {
                       System.out.println("----
                       //int r=1;
                  // Loop over all columns in the current row
                  for (JCO.FieldIterator e = sales_orders1.fields(); e.hasMoreElements();)
                             JCO.Field field1 = e.nextField();
                         //String compcode=field1.getString();
                         //pst.setString(r,compcode);
                         System.out.println(field1.getName() + ":\t" + field1.getString());
                        // r++;
                                                                                    }//for
                      // i=pst.executeUpdate();
                  } while(sales_orders1.nextRow());
              else {
                System.out.println("No results found");
               System.out.println("modified"+sales_orders1.getNumRows());
               System.out.println("modified"+sales_orders.getNumRows());
            //if
           /* if(i>=1)
                 System.out.println("\t\t\tUpdated ORACLE successfully");
          else {
            System.out.println("FUNCTION MODULE not found in backend system.");
          }//if
        catch (JCO.AbapException ex) {
          System.out.println("Caught an exception: \n" + ex);
        }catch(Exception en){en.printStackTrace();}
        finally {
                   JCO.releaseClient(client);
      protected void cleanUp() {
          JCO.removeClientPool(SID);
      public static void main(String[] argv)
        Fm e=new Fm();
       // e.systemInfo();
        e.salesOrders();
        e.cleanUp();
    output:
    TABLE: MODIFIED_KEYS
    TABLE: PROPOSED_VALUES
    IMPORT         ACTIO
    IMPORT         BEGDA
    IMPORT         DIALOG_MODE
    IMPORT         ENDDA
    IMPORT         LUW_MODE
    IMPORT         MASSN
    IMPORT         NO_ENQUEUE
    IMPORT         NO_EXISTENCE_CHECK
    IMPORT         OBJPS
    IMPORT         PERNR
    IMPORT         PERSG
    IMPORT         PERSK
    IMPORT         PLANS
    IMPORT         SEQNR
    IMPORT         SPRPS
    IMPORT         SUBTY
    IMPORT         TCLAS
    IMPORT         WERKS
    EXPORT          HR_RETURN
    EXPORT          RETURN
    EXPORT          RETURN1
    appending
    NO OF ROWS ARE:---3
    THE COLUMNS IN THE TABLE ARE:--4
    INFTY:     0582
    FNAME:     P0582-AMTEX
    FVAL:     200.00
    SEQNR:     00
    INFTY:     0582
    FNAME:     P0582-JBGDT
    FVAL:     20061215
    SEQNR:     00
    INFTY:     0582
    FNAME:     P0582-JENDT
    FVAL:     20061215
    SEQNR:     00
    PERNR:     00000011
    INFTY:     0582
    SUBTY:     LTA
    OBJPS:     1
    SPRPS:     
    ENDDA:     2006-12-15
    BEGDA:     2006-12-15
    SEQNR:     000

    hi jagadesh,
    ur code is very length to see.
    see the following code ,
    JCO.Function objFunction =
                   this
                        .objIRepository
                        .getFunctionTemplate("BAPI_MATERIAL_AVAILABILITY")
                        .getFunction();
              objFunction.getImportParameterList().setValue(strPlant, "PLANT");
              objFunction.getImportParameterList().setValue(strMaterial, "MATERIAL");
              objFunction.getImportParameterList().setValue(strQuantity, "UNIT");
              this.objClient.execute(objFunction);
              JCO.Structure ret =
                   objFunction.getExportParameterList().getStructure("RETURN");
              String strRetMsg = ret.getString("MESSAGE");
    System.out.println(strRetMsg);  // it will tell whether record is inserted or not
    /*JCO.Function objFunction1 =
                   this
                        .objIRepository
                        .getFunctionTemplate("BAPI_TRANSACTION_COMMIT")
                        .getFunction();
    objFunction1.setValue("",WAIT);
    objClient.execute(objFunction1);*/
    CHECK THE RETURN MSG .IT WILL TELL THE PROBLEM
    give me points if it is useful
    regards
    Guru
    Message was edited by:
            Guruvulu Bojja
    Message was edited by:
            Guruvulu Bojja
    Message was edited by:
            Guruvulu Bojja

  • Incomplete Data on report (report does not show all records from the table)

    Hello,
    I have problem with CR XI, I'm running the same report on the same data with simple select all records from the table (no sorting, no grouping, no filters)
    Sometimes report shows me all records sometimes not. Mostly not all records on the report. When report incomplete sometimes it shows different number of records.
    I'm using CR XI runtime on Windows Server 2003
    Any help appreciated
    Thanks!

    Sorry Alexander. I missed the last line where you clearly say it is runtime.
    A few more questions:
    - Which CR SDK are you using? The Report Designer Component or the CR assemblies for .NET?
    - What is the exact version of CR you are using (from help | about)
    - What CR Service Pack are you on?
    And a troubleshooting suggestion:
    Since this works on some machines, it will be a good idea to compare all the runtime (both CR and non CR) being loaded on a working and non working machines.
    Download the modules utility from here:
    https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip
    and follow the steps as described in this thread:
    https://forums.sdn.sap.com/click.jspa?searchID=18424085&messageID=6186767
    The download also includes instructions on how to use modules.
    Ludek

  • Printing out results in case of object-relational table (Oracle)

    I have made a table with this structure:
    CREATE OR REPLACE TYPE Boat AS OBJECT(
    Name varchar2(30),
    Ident number,
    CREATE OR REPLACE TYPE Type_boats AS TABLE OF Boat;
    CREATE TABLE HOUSE(
    Name varchar2(40),
    MB Type_boats)
    NESTED TABLE MB store as P_Boat;
    INSERT INTO House VALUES ('Name',Type_boats(Boat('Boat1', 1)));
    I am using java to print out all the results by calling a procedure.
    CREATE OR REPLACE package House_boats
    PROCEDURE add(everything works here)
    PROCEDURE results_view;
    END House_boats;
    CREATE OR REPLACE Package.body House_boats AS
    PROCEDURE add(everything works here) AS LANGUAGE JAVA
    Name House_boats.add(...)
    PROCEDURE results_view AS LANGUAGE JAVA
    Name House_boats.resuts_view();
    END House_boats;
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    CALL House_boats.results_view();
    House_boats.java file which is loaded using LOADJAVA:
    import java.sql.*;
    import java io.*;
    public class House_boats {
    public static void results_view ()
       throws SQLException
       { String sql =
       "SELECT * from House";
       try { Connection conn = DriverManager.getConnection
    ("jdbc:default:connection:");
       PreparedStatement pstmt = conn.prepareStatement(sql);
       ResultSet rset = pstmt.executeQuery();
      printResults(rset);
      rset.close();
      pstmt.close();
       catch (SQLException e) {System.err.println(e.getMessage());
    static void printResults (ResultSet rset)
       throws SQLException { String buffer = "";
       try { ResultSetMetaData meta = rset.getMetaData();
       int cols = meta.getColumnCount(), rows = 0;
       for (int i = 1; i <= cols; i++)
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       if (label.length() > size) size = label.length();
       while (label.length() < size) label += " ";
      buffer = buffer + label + " "; }
      buffer = buffer + "\n";
       while (rset.next()) {
      rows++;
       for (int i = 1; i <= cols; i++) {
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       String value = rset.getString(i);
       if (label.length() > size) size = label.length();
       while (value.length() < size) value += " ";
      buffer = buffer + value + " ";  }
      buffer = buffer + "\n";   }
       if (rows == 0) buffer = "No data found!\n";
       System.out.println(buffer); }
       catch (SQLException e) {System.err.println(e.getMessage());}  }
    How do I print out the results correctly in my case of situation?
    Thank you in advance

    I have made a table with this structure:
    I am using java to print out all the results by calling a procedure.
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    How do I print out the results correctly in my case of situation?
    There are several things wrong with your code and methodology
    1. The code you posted won't even compile because there are several syntax issues.
    2. You are trying to use/test Java in the database BEFORE you get the code working outside the DB
    3. Your code is not using collections in JDBC properly
    I suggest that you use a different, proven approach to developing Java code for use in the DB
    1. Use SIMPLE examples and then build on them. In this case that means don't add collections to the example until ALL other aspects of the app work properly.
    2. Create and test the Java code OUTSIDE of the database. It is MUCH easier to work outside the database and there are many more tools to help you (e.g. NetBeans, debuggers, DBMS_OUTPUT windows, etc). Trying to debug Java code after you have already loaded it into the DB is too difficult. I'm not aware of anyone, even at the expert level, that develops that way.
    3. When using complex functionality like collections first read the Oracle documentation (JDBC Developer Guide and Java Developer's Guide). Those docs have examples that are known to work.
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#sthref583
    The main issue with your example is #3 above; you are not using collections properly:
    String value = rset.getString(i);
    A collection is NOT a string so why would you expect that to work for a nested table?
    A collection needs to be treated like a collection. You can even treat the collection as a separate result set. Create your code outside the database and use the debugger in NetBeans (or other) on this replacement code for your 'printResults' method:
    static void printResults (ResultSet rset) throws SQLException {
        try {
           ResultSetMetaData meta = rset.getMetaData();
           while (rset.next()) {
               ResultSet rs = rset.getArray(2).getResultSet();
               rs.next();
               String ndx = rs.getString(1);
               Struct struct = (Struct) rs.getObject(2);
               System.out.println(struct.getSQLTypeName());
               Object [] oa = struct.getAttributes();
               for (int j = 0; j < oa.length; j++) {
                  System.out.println(oa[j]);
        } catch  (SQLException e) {
           System.err.println(e.getMessage());
    That code ONLY deals with column 2 which is the nested table. It gets that collection as a new resultset ('rs'). Then it gets the contents of that nested table as an array of objects and prints out the attributes of those objects so you can see them.
    Step through the above code in a debugger so you can SEE what is happening. NetBeans also lets you enter expressions such as 'rs' in an evaluation window so you can dynamically try the different methods to see what they do for you.
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    Since your current issue has nothing to do with this forum I suggest that you mark this thread ANSWERED and repost it in the JDBC forum if you need further help with this issue.
    https://forums.oracle.com/community/developer/english/java/database_connectivity
    When you repost you can include a link to this current thread if you want. Once your Java code is actually working then try the Java Stored procedure examples in the Java Developer's Guide doc linked above.
    At the point you have any issues that relate to Java stored procedures then you should post them in the SQL and PL/SQL forum
    https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql

  • How to create XML from relational tables based on an XML Schema ?

    There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
    However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
    If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
    The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
    SQL> drop table PURCHASEORDER_LINEITEM
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_REJECTION
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_SHIPPING
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_ACTION
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_TABLE
      2  /
    Table dropped.
    SQL> create table PURCHASEORDER_TABLE
      2  (
      3   REFERENCE                                          VARCHAR2(28),
      4   PRIMARY KEY ("REFERENCE"),
      5   REQUESTER                                          VARCHAR2(48),
      6   USERID                                             VARCHAR2(32),
      7   COSTCENTER                                         VARCHAR2(3),
      8   SPECIALINSTRUCTIONS                                VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_ACTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   ACTIONEDBY                                         VARCHAR2(32),
      6   DATEACTIONED                                       DATE
      7  )
      8  /
    Table created.
    SQL> create table PURCHASEORDER_SHIPPING
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   SHIPTONAME                                         VARCHAR2(48),
      7   ADDRESS                                            VARCHAR2(512),
      8   PHONE                                              VARCHAR2(32)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_REJECTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   REJECTEDBY                                         VARCHAR2(32),
      7   DATEREJECTED                                       DATE,
      8   COMMENTS                                           VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_LINEITEM
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   LINENO                                             NUMBER(10),
      6   PRIMARY KEY ("REFERENCE","LINENO"),
      7   UPC                                                   VARCHAR2(14),
      8   DESCRIPTION                                        VARCHAR2(128),
      9   QUANTITY                                           NUMBER(10),
    10   UNITPRICE                                          NUMBER(12,2)
    11  )
    12  /
    Table created.
    SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
    5,USA','650 506 7800')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
    95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
      2  /
    1 row created.
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
      3    :schemaPath := '/public/purchaseOrder.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
    ue">
      6          <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
      7          <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
      8                  <xs:sequence>
      9                          <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
    10                          <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
    11                          <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
    12                          <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
    13                          <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
    14                          <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
    15                          <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
    16                          <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
    17                          <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
    18                  </xs:sequence>
    19          </xs:complexType>
    20          <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
    21                  <xs:sequence>
    22                          <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
    INEITEM_V"/>
    23                  </xs:sequence>
    24          </xs:complexType>
    25          <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
    26                  <xs:sequence>
    27                          <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
    28                          <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
    29                  </xs:sequence>
    30                  <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
    31          </xs:complexType>
    32          <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
    33                  <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
    34                          <xs:simpleType>
    35                                  <xs:restriction base="xs:string">
    36                                          <xs:minLength value="10"/>
    37                                          <xs:maxLength value="14"/>
    38                                  </xs:restriction>
    39                          </xs:simpleType>
    40                  </xs:attribute>
    41                  <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
    42                  <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
    43          </xs:complexType>
    44          <xs:simpleType name="ReferenceType">
    45                  <xs:restriction base="xs:string">
    46                          <xs:minLength value="18"/>
    47                          <xs:maxLength value="30"/>
    48                  </xs:restriction>
    49          </xs:simpleType>
    50          <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
    51                  <xs:sequence>
    52                          <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
    53                                  <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
    54                                          <xs:sequence>
    55                                                  <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
    56                                                  <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
    57                                          </xs:sequence>
    58                                  </xs:complexType>
    59                          </xs:element>
    60                  </xs:sequence>
    61          </xs:complexType>
    62          <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
    63                  <xs:all>
    64                          <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
    65                          <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
    66                          <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
    67                  </xs:all>
    68          </xs:complexType>
    69          <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
    70                  <xs:sequence>
    71                          <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
    72                          <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
    73                          <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
    74                  </xs:sequence>
    75          </xs:complexType>
    76          <xs:simpleType name="moneyType">
    77                  <xs:restriction base="xs:decimal">
    78                          <xs:fractionDigits value="2"/>
    79                          <xs:totalDigits value="12"/>
    80                  </xs:restriction>
    81          </xs:simpleType>
    82          <xs:simpleType name="quantityType">
    83                  <xs:restriction base="xs:decimal">
    84                          <xs:fractionDigits value="4"/>
    85                          <xs:totalDigits value="8"/>
    86                  </xs:restriction>
    87          </xs:simpleType>
    88          <xs:simpleType name="UserType">
    89                  <xs:restriction base="xs:string">
    90                          <xs:minLength value="1"/>
    91                          <xs:maxLength value="10"/>
    92                  </xs:restriction>
    93          </xs:simpleType>
    94          <xs:simpleType name="RequestorType">
    95                  <xs:restriction base="xs:string">
    96                          <xs:minLength value="0"/>
    97                          <xs:maxLength value="128"/>
    98                  </xs:restriction>
    99          </xs:simpleType>
    100          <xs:simpleType name="CostCenterType">
    101                  <xs:restriction base="xs:string">
    102                          <xs:minLength value="1"/>
    103                          <xs:maxLength value="4"/>
    104                  </xs:restriction>
    105          </xs:simpleType>
    106          <xs:simpleType name="VendorType">
    107                  <xs:restriction base="xs:string">
    108                          <xs:minLength value="0"/>
    109                          <xs:maxLength value="20"/>
    110                  </xs:restriction>
    111          </xs:simpleType>
    112          <xs:simpleType name="PurchaseOrderNumberType">
    113                  <xs:restriction base="xs:integer"/>
    114          </xs:simpleType>
    115          <xs:simpleType name="SpecialInstructionsType">
    116                  <xs:restriction base="xs:string">
    117                          <xs:minLength value="0"/>
    118                          <xs:maxLength value="2048"/>
    119                  </xs:restriction>
    120          </xs:simpleType>
    121          <xs:simpleType name="NameType">
    122                  <xs:restriction base="xs:string">
    123                          <xs:minLength value="1"/>
    124                          <xs:maxLength value="20"/>
    125                  </xs:restriction>
    126          </xs:simpleType>
    127          <xs:simpleType name="AddressType">
    128                  <xs:restriction base="xs:string">
    129                          <xs:minLength value="1"/>
    130                          <xs:maxLength value="256"/>
    131                  </xs:restriction>
    132          </xs:simpleType>
    133          <xs:simpleType name="TelephoneType">
    134                  <xs:restriction base="xs:string">
    135                          <xs:minLength value="1"/>
    136                          <xs:maxLength value="24"/>
    137                  </xs:restriction>
    138          </xs:simpleType>
    139          <xs:simpleType name="DateType">
    140                  <xs:restriction base="xs:date"/>
    141          </xs:simpleType>
    142          <xs:simpleType name="CommentsType">
    143                  <xs:restriction base="xs:string">
    144                          <xs:minLength value="1"/>
    145                          <xs:maxLength value="2048"/>
    146                  </xs:restriction>
    147          </xs:simpleType>
    148          <xs:simpleType name="DescriptionType">
    149                  <xs:restriction base="xs:string">
    150                          <xs:minLength value="1"/>
    151                          <xs:maxLength value="256"/>
    152                  </xs:restriction>
    153          </xs:simpleType>
    154  </xs:schema>
    155  ');
    156  begin
    157    if (dbms_xdb.existsResource(:schemaPath)) then
    158      dbms_xdb.deleteResource(:schemaPath);
    159    end if;
    160    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    161  end;
    162  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,FALSE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> create or replace view PURCHASEORDER_XML
      2  of xmltype
      3  xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
      4  with object id
      5  (
      6    substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
      7  )
      8  as
      9    select xmlElement
    10           (
    11             "PurchaseOrder",
    12             xmlAttributes
    13             (
    14               'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
    15               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
    16             ),
    17             xmlElement("Reference",p.REFERENCE),
    18             xmlElement
    19             (
    20               "Actions",
    21               ( select xmlAgg
    22                        (
    23                          xmlElement
    24                          (
    25                            "Action",
    26                            xmlElement("User",ACTIONEDBY),
    27                            case
    28                              when DATEACTIONED is not null
    29                              then xmlElement("Date",DATEACTIONED)
    30                            end
    31                          )
    32                        )
    33                   from PURCHASEORDER_ACTION a
    34                  where a.REFERENCE = p.REFERENCE
    35               )
    36             ),
    37             xmlElement
    38             (
    39               "Reject",
    40                  xmlForest
    41                  (
    42                    REJECTEDBY as "User",
    43                 DATEREJECTED as "Date",
    44                    COMMENTS as "Comments"
    45                  )
    46             ),
    47             xmlElement("Requestor",REQUESTER),
    48             xmlElement("User",USERID),
    49             xmlElement("CostCenter",COSTCENTER),
    50             xmlElement
    51             (
    52               "ShippingInstructions",
    53               xmlElement("name",SHIPTONAME),
    54               xmlElement("address",ADDRESS),
    55               xmlElement("telephone",PHONE)
    56             ),
    57             xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
    58             xmlElement
    59             (
    60               "LineItems",
    61               ( select xmlAgg
    62                        (
    63                          xmlElement
    64                          (
    65                            "LineItem",
    66                            xmlAttributes(LINENO as "ItemNumber"),
    67                            xmlElement("Description",DESCRIPTION),
    68                            xmlElement
    69                            (
    70                              "Part",
    71                              xmlAttributes
    72                              (
    73                                UPC       as "Id",
    74                                QUANTITY  as "Quantity",
    75                                UNITPRICE as "UnitPrice"
    76                              )
    77                            )
    78                          )
    79                        )
    80                    from PURCHASEORDER_LINEITEM l
    81                   where l.REFERENCE = p.REFERENCE
    82               )
    83             )
    84           )
    85      from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
    86     where r.REFERENCE = p.REFERENCE
    87       and s.REFERENCE = p.REFERENCE
    88  /
    View created.
    SQL> set long 10000 pages 0 lines 140
    SQL> --
    SQL> select x.object_value.extract('/*')
      2    from PURCHASEORDER_XML x
      3  /
    <PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Reference>SMCCAIN-20030109123335470PDT</Reference>
      <Actions>
        <Action>
          <User>SVOLLMAN</User>
        </Action>
      </Actions>
      <Reject/>
      <Requestor>Samuel B. McCain</Requestor>
      <User>SMCCAIN</User>
      <CostCenter>A10</CostCenter>
      <ShippingInstructions>
        <name>Samuel B. McCain</name>
        <address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
        <telephone>650 506 7800</telephone>
      </ShippingInstructions>
      <SpecialInstructions>Courier</SpecialInstructions>
      <LineItems>
        <LineItem ItemNumber="1">
          <Description>Life of Brian - Monty Python&apos;s</Description>
          <Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="2">
          <Description>The Night Porter</Description>
          <Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="3">
          <Description>Oliver Twist</Description>
          <Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="4">
          <Description>Notorious</Description>
          <Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="5">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="6">
          <Description>Alphaville</Description>
          <Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="7">
          <Description>General Idi Amin Dada</Description>
          <Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="8">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="9">
          <Description>Flesh for Frankenstein</Description>
          <Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="10">
          <Description>The Killer</Description>
          <Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="11">
          <Description>Ballad of a Soldier</Description>
          <Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="12">
          <Description>Ordet</Description>
          <Part Id="37429158623" Quantity="2" UnitPrice="0"/>
        </LineItem>
      </LineItems>
    </PurchaseOrder>
    SQL> begin
      2    for x in (select object_value from PURCHASEORDER_XML) loop
      3      x.object_value.schemaValidate();
      4    end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>

    There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
    However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
    If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
    The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
    SQL> drop table PURCHASEORDER_LINEITEM
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_REJECTION
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_SHIPPING
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_ACTION
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_TABLE
      2  /
    Table dropped.
    SQL> create table PURCHASEORDER_TABLE
      2  (
      3   REFERENCE                                          VARCHAR2(28),
      4   PRIMARY KEY ("REFERENCE"),
      5   REQUESTER                                          VARCHAR2(48),
      6   USERID                                             VARCHAR2(32),
      7   COSTCENTER                                         VARCHAR2(3),
      8   SPECIALINSTRUCTIONS                                VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_ACTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   ACTIONEDBY                                         VARCHAR2(32),
      6   DATEACTIONED                                       DATE
      7  )
      8  /
    Table created.
    SQL> create table PURCHASEORDER_SHIPPING
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   SHIPTONAME                                         VARCHAR2(48),
      7   ADDRESS                                            VARCHAR2(512),
      8   PHONE                                              VARCHAR2(32)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_REJECTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   REJECTEDBY                                         VARCHAR2(32),
      7   DATEREJECTED                                       DATE,
      8   COMMENTS                                           VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_LINEITEM
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   LINENO                                             NUMBER(10),
      6   PRIMARY KEY ("REFERENCE","LINENO"),
      7   UPC                                                   VARCHAR2(14),
      8   DESCRIPTION                                        VARCHAR2(128),
      9   QUANTITY                                           NUMBER(10),
    10   UNITPRICE                                          NUMBER(12,2)
    11  )
    12  /
    Table created.
    SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
    5,USA','650 506 7800')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
    95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
      2  /
    1 row created.
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
      3    :schemaPath := '/public/purchaseOrder.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
    ue">
      6          <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
      7          <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
      8                  <xs:sequence>
      9                          <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
    10                          <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
    11                          <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
    12                          <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
    13                          <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
    14                          <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
    15                          <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
    16                          <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
    17                          <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
    18                  </xs:sequence>
    19          </xs:complexType>
    20          <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
    21                  <xs:sequence>
    22                          <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
    INEITEM_V"/>
    23                  </xs:sequence>
    24          </xs:complexType>
    25          <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
    26                  <xs:sequence>
    27                          <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
    28                          <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
    29                  </xs:sequence>
    30                  <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
    31          </xs:complexType>
    32          <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
    33                  <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
    34                          <xs:simpleType>
    35                                  <xs:restriction base="xs:string">
    36                                          <xs:minLength value="10"/>
    37                                          <xs:maxLength value="14"/>
    38                                  </xs:restriction>
    39                          </xs:simpleType>
    40                  </xs:attribute>
    41                  <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
    42                  <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
    43          </xs:complexType>
    44          <xs:simpleType name="ReferenceType">
    45                  <xs:restriction base="xs:string">
    46                          <xs:minLength value="18"/>
    47                          <xs:maxLength value="30"/>
    48                  </xs:restriction>
    49          </xs:simpleType>
    50          <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
    51                  <xs:sequence>
    52                          <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
    53                                  <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
    54                                          <xs:sequence>
    55                                                  <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
    56                                                  <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
    57                                          </xs:sequence>
    58                                  </xs:complexType>
    59                          </xs:element>
    60                  </xs:sequence>
    61          </xs:complexType>
    62          <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
    63                  <xs:all>
    64                          <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
    65                          <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
    66                          <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
    67                  </xs:all>
    68          </xs:complexType>
    69          <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
    70                  <xs:sequence>
    71                          <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
    72                          <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
    73                          <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
    74                  </xs:sequence>
    75          </xs:complexType>
    76          <xs:simpleType name="moneyType">
    77                  <xs:restriction base="xs:decimal">
    78                          <xs:fractionDigits value="2"/>
    79                          <xs:totalDigits value="12"/>
    80                  </xs:restriction>
    81          </xs:simpleType>
    82          <xs:simpleType name="quantityType">
    83                  <xs:restriction base="xs:decimal">
    84                          <xs:fractionDigits value="4"/>
    85                          <xs:totalDigits value="8"/>
    86                  </xs:restriction>
    87          </xs:simpleType>
    88          <xs:simpleType name="UserType">
    89                  <xs:restriction base="xs:string">
    90                          <xs:minLength value="1"/>
    91                          <xs:maxLength value="10"/>
    92                  </xs:restriction>
    93          </xs:simpleType>
    94          <xs:simpleType name="RequestorType">
    95                  <xs:restriction base="xs:string">
    96                          <xs:minLength value="0"/>
    97                          <xs:maxLength value="128"/>
    98                  </xs:restriction>
    99          </xs:simpleType>
    100          <xs:simpleType name="CostCenterType">
    101                  <xs:restriction base="xs:string">
    102                          <xs:minLength value="1"/>
    103                          <xs:maxLength value="4"/>
    104                  </xs:restriction>
    105          </xs:simpleType>
    106          <xs:simpleType name="VendorType">
    107                  <xs:restriction base="xs:string">
    108                          <xs:minLength value="0"/>
    109                          <xs:maxLength value="20"/>
    110                  </xs:restriction>
    111          </xs:simpleType>
    112          <xs:simpleType name="PurchaseOrderNumberType">
    113                  <xs:restriction base="xs:integer"/>
    114          </xs:simpleType>
    115          <xs:simpleType name="SpecialInstructionsType">
    116                  <xs:restriction base="xs:string">
    117                          <xs:minLength value="0"/>
    118                          <xs:maxLength value="2048"/>
    119                  </xs:restriction>
    120          </xs:simpleType>
    121          <xs:simpleType name="NameType">
    122                  <xs:restriction base="xs:string">
    123                          <xs:minLength value="1"/>
    124                          <xs:maxLength value="20"/>
    125                  </xs:restriction>
    126          </xs:simpleType>
    127          <xs:simpleType name="AddressType">
    128                  <xs:restriction base="xs:string">
    129                          <xs:minLength value="1"/>
    130                          <xs:maxLength value="256"/>
    131                  </xs:restriction>
    132          </xs:simpleType>
    133          <xs:simpleType name="TelephoneType">
    134                  <xs:restriction base="xs:string">
    135                          <xs:minLength value="1"/>
    136                          <xs:maxLength value="24"/>
    137                  </xs:restriction>
    138          </xs:simpleType>
    139          <xs:simpleType name="DateType">
    140                  <xs:restriction base="xs:date"/>
    141          </xs:simpleType>
    142          <xs:simpleType name="CommentsType">
    143                  <xs:restriction base="xs:string">
    144                          <xs:minLength value="1"/>
    145                          <xs:maxLength value="2048"/>
    146                  </xs:restriction>
    147          </xs:simpleType>
    148          <xs:simpleType name="DescriptionType">
    149                  <xs:restriction base="xs:string">
    150                          <xs:minLength value="1"/>
    151                          <xs:maxLength value="256"/>
    152                  </xs:restriction>
    153          </xs:simpleType>
    154  </xs:schema>
    155  ');
    156  begin
    157    if (dbms_xdb.existsResource(:schemaPath)) then
    158      dbms_xdb.deleteResource(:schemaPath);
    159    end if;
    160    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    161  end;
    162  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,FALSE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> create or replace view PURCHASEORDER_XML
      2  of xmltype
      3  xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
      4  with object id
      5  (
      6    substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
      7  )
      8  as
      9    select xmlElement
    10           (
    11             "PurchaseOrder",
    12             xmlAttributes
    13             (
    14               'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
    15               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
    16             ),
    17             xmlElement("Reference",p.REFERENCE),
    18             xmlElement
    19             (
    20               "Actions",
    21               ( select xmlAgg
    22                        (
    23                          xmlElement
    24                          (
    25                            "Action",
    26                            xmlElement("User",ACTIONEDBY),
    27                            case
    28                              when DATEACTIONED is not null
    29                              then xmlElement("Date",DATEACTIONED)
    30                            end
    31                          )
    32                        )
    33                   from PURCHASEORDER_ACTION a
    34                  where a.REFERENCE = p.REFERENCE
    35               )
    36             ),
    37             xmlElement
    38             (
    39               "Reject",
    40                  xmlForest
    41                  (
    42                    REJECTEDBY as "User",
    43                 DATEREJECTED as "Date",
    44                    COMMENTS as "Comments"
    45                  )
    46             ),
    47             xmlElement("Requestor",REQUESTER),
    48             xmlElement("User",USERID),
    49             xmlElement("CostCenter",COSTCENTER),
    50             xmlElement
    51             (
    52               "ShippingInstructions",
    53               xmlElement("name",SHIPTONAME),
    54               xmlElement("address",ADDRESS),
    55               xmlElement("telephone",PHONE)
    56             ),
    57             xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
    58             xmlElement
    59             (
    60               "LineItems",
    61               ( select xmlAgg
    62                        (
    63                          xmlElement
    64                          (
    65                            "LineItem",
    66                            xmlAttributes(LINENO as "ItemNumber"),
    67                            xmlElement("Description",DESCRIPTION),
    68                            xmlElement
    69                            (
    70                              "Part",
    71                              xmlAttributes
    72                              (
    73                                UPC       as "Id",
    74                                QUANTITY  as "Quantity",
    75                                UNITPRICE as "UnitPrice"
    76                              )
    77                            )
    78                          )
    79                        )
    80                    from PURCHASEORDER_LINEITEM l
    81                   where l.REFERENCE = p.REFERENCE
    82               )
    83             )
    84           )
    85      from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
    86     where r.REFERENCE = p.REFERENCE
    87       and s.REFERENCE = p.REFERENCE
    88  /
    View created.
    SQL> set long 10000 pages 0 lines 140
    SQL> --
    SQL> select x.object_value.extract('/*')
      2    from PURCHASEORDER_XML x
      3  /
    <PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Reference>SMCCAIN-20030109123335470PDT</Reference>
      <Actions>
        <Action>
          <User>SVOLLMAN</User>
        </Action>
      </Actions>
      <Reject/>
      <Requestor>Samuel B. McCain</Requestor>
      <User>SMCCAIN</User>
      <CostCenter>A10</CostCenter>
      <ShippingInstructions>
        <name>Samuel B. McCain</name>
        <address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
        <telephone>650 506 7800</telephone>
      </ShippingInstructions>
      <SpecialInstructions>Courier</SpecialInstructions>
      <LineItems>
        <LineItem ItemNumber="1">
          <Description>Life of Brian - Monty Python&apos;s</Description>
          <Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="2">
          <Description>The Night Porter</Description>
          <Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="3">
          <Description>Oliver Twist</Description>
          <Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="4">
          <Description>Notorious</Description>
          <Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="5">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="6">
          <Description>Alphaville</Description>
          <Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="7">
          <Description>General Idi Amin Dada</Description>
          <Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="8">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="9">
          <Description>Flesh for Frankenstein</Description>
          <Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="10">
          <Description>The Killer</Description>
          <Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="11">
          <Description>Ballad of a Soldier</Description>
          <Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="12">
          <Description>Ordet</Description>
          <Part Id="37429158623" Quantity="2" UnitPrice="0"/>
        </LineItem>
      </LineItems>
    </PurchaseOrder>
    SQL> begin
      2    for x in (select object_value from PURCHASEORDER_XML) loop
      3      x.object_value.schemaValidate();
      4    end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>

  • Reading XML file from specific location&Storing xmldata into related tables

    I am new to xml.
    My requirement is,
    1) Get the xml file from specified location (C:\xmlfiles\ xmldata.xml)
    2)Convert xml data in clob data.
    3)store the data into related table.
    and vice-versa.
    What i did,
    a) I got the data from related tables and converted into xmlformat using SQLX
    b)converted this resultset into clob data and stored as xml file in specific location.
    It uses more then ten tables.
    All this help i got from AskTom site , thanks for that.
    Now i have to do vise-versa, i.e. i have to perform 1), 2), 3) steps........
    Please tell me proper steps to acheive it.
    Thanks in advance for giving your precious time to solve my issue.

    Have you read the"XMLDB FAQ" in this Forum?
    You could use stuff like:
    create or replace directory xmldir as C:\xmlfiles'
    declare
    xmldata xmltype;
    begin
    xmldata := xmltype(bfilename('XMLDIR','xmldata.xml'),nls_charset_id('AL32UTF8'));
      -- etc, etc your code --
      -- --> convert to clob by using for instance getclobval() function
      -- --> then insert the data in your relational table with CLOB column
      -- etc, etc your code --
    end;
    /

  • Crystal reports over SAP r/3 tables

    I am trying to write a Crystal report over SAP r/3 tables (BSIK and LFA1) with no success.
    I have CRpts installed along with the "client side" SAP integration kit.  When i try to create a new connection to my development ERP system i am asked to select an available system, but the dialogue box is empty.   I can however connect to a SAP BW query successfully using the SAP toolbar that has been added when installing the integration kit.
    Is there anywhere a set if instructions to successfully install and configure CRpts to report over SAP r/3 tables ?
    Andrew Fox

    Make sure to define an environment variable called SAPLOGON_INI_FILE in the system your CR designer is installed on. The variable should contain the path to your SAPlogon.ini file including the file name. eg if saplogon.ini is found under c:\Windows then the variable shoud be set to c:\Windows\saplogon.ini . Restart the CR designer and try again.
    If the system list remains empty then locate to saplogon.ini file, open it using Notepad and choose the Save as option. All you have to do is to overwrite the existing file (ie. do not change the name) after changing the encoding to UTF-8 (drop-down list at the bottom of the Save as window)
    Regards,
    Stratos

Maybe you are looking for

  • How can I use external clock to implement a delay?

    Hi all,   I am testing to use external clock to drive dev/PFI0 (on device 6711) which is used as the clock for the analog ouput. I have thinking two applications by using the external clock but I don't have much idea on the implementation yet. First

  • Flickering screens during animations

    I get multiple flickering white horizon zaps across my screen whenever there's an animation playing. This happens in Safari, on certain pages with animations and in iMovie whenever an animated effect is preveiwed, but not when the effect is applied t

  • How to integrate BRF+ application in WEBDynpro abap

    Hello, Can anybody tell me , how to integrate BRFPLUS application to Webdynpro components. is their any configuration or code is available for the same? Thanks Rakshar

  • Af:autoSuggestBehavior

    on Jdeveloper 11g Release 2. I got an af:autoSuggestBehavior working in this way : Accountid is the field with the autoSuggest type: 1 show 1000 1010 1020 1030 I want this Type : 1 show 1000 Petty Cash 1010 Cash on Hand 1020 Regular Checking 1030 Sav

  • CSS : trying to create a link where it isn't effected by template CSS

    Hi guys Experimenting with CSS today, have created a menu with a a background image which activates on hover to make behind the HTML text look inset - worked out great! However now every other link on my page also has the background imge when hoverin