Mapping CLOB and Long in xml schema

Hi,
I am creating an xml schema to map some user defined database objects. For example, for a column which is defined as VARCHAR2 in the database, I have the following xsd type mapping.
<xsd:element name="Currency" type="xsd:string" />
If the oracle column is CLOB or Long(Oracle datatype), could you please tell me how I can map it in the xml schema? I do not want to use Oracle SQL type like:
xdb:SQLType="CLOB" since I need a generic type mapping to CLOB. Would xsd:string still hold good for CLOB as well as Long(Oracle datatype) ?
Please help.
Thanks,
Vadi.

The problem is that LONGs are not buffered but are read from the wire in the order defined. The problem is the same as
rs = stmt.executeQuery("select myLong, myNumber from tab");
while (rs.next()) {
int n = rs.getInt(2);
String s = rs.getString(1);
The above will fail for the same reason. When the statement is executed the LONG is not read immediately. It is buffered in the server waiting to be read. When getInt is called the driver reads the bytes of the LONG and throws them away so that it can get to the NUMBER and read it. Then when getString is called the LONG value is gone so you get an exception.
Similar problem here. When the query is executed the CLOB and BLOB locators are read from the wire, but the LONG is buffered in the server waiting to be read. When Clob.getString is called, it has to talk to the server to get the value of the CLOB, so it reads the LONG bytes from the wire and throws them away. That clears the connection so that it can ask the server for the CLOB bytes. When the code reads the LONG value, those bytes are gone so you get an exception.
This is a long standing restriction on using LONG and LONG RAW values and is a result of the network protocol. It is one of the reasons that Oracle deprecates LONGs and recommends using BLOBs and CLOBs instead.
Douglas

Similar Messages

  • Can't fetch clob and long in one select/query

    I created a nightmare table containing numerous binary data types to test an application I was working on, and believe I have found an undocumented bug in Oracle's JDBC drivers that is preventing me from loading a CLOB and a LONG in a single SQL select statement. I can load the CLOB successfully, but attempting to call ResultSet.get...() for the LONG column always results in
    java.sql.SQLException: Stream has already been closed
    even when processing the columns in the order of the SELECT statement.
    I have demonstrated this behaviour with version 9.2.0.3 of Oracle's JDBC drivers, running against Oracle 9.2.0.2.0.
    The following Java example contains SQL code to create and populate a table containing a collection of nasty binary columns, and then Java code that demonstrates the problem.
    I would really appreciate any workarounds that allow me to pull this data out of a single query.
    import java.sql.*;
    This class was developed to verify that you can't have a CLOB and a LONG column in the
    same SQL select statement, and extract both values. Calling get...() for the LONG column
    always causes 'java.sql.SQLException: Stream has already been closed'.
    CREATE TABLE BINARY_COLS_TEST
    PK INTEGER PRIMARY KEY NOT NULL,
    CLOB_COL CLOB,
    BLOB_COL BLOB,
    RAW_COL RAW(100),
    LONG_COL LONG
    INSERT INTO BINARY_COLS_TEST (
    PK,
    CLOB_COL,
    BLOB_COL,
    RAW_COL,
    LONG_COL
    ) VALUES (
    1,
    '-- clob value --',
    HEXTORAW('01020304050607'),
    HEXTORAW('01020304050607'),
    '-- long value --'
    public class JdbcLongTest
    public static void main(String argv[])
    throws Exception
    Driver driver = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    DriverManager.registerDriver(driver);
    Connection connection = DriverManager.getConnection(argv[0], argv[1], argv[2]);
    Statement stmt = connection.createStatement();
    ResultSet results = null;
    try
    String query = "SELECT pk, clob_col, blob_col, raw_col, long_col FROM binary_cols_test";
    results = stmt.executeQuery(query);
    while (results.next())
    int pk = results.getInt(1);
    System.out.println("Loaded int");
    Clob clob = results.getClob(2);
    // It doesn't work if you just close the ascii stream.
    // clob.getAsciiStream().close();
    String clobString = clob.getSubString(1, (int)clob.length());
    System.out.println("Loaded CLOB");
    // Streaming not strictly necessary for short values.
    // Blob blob = results.getBlob(3);
    byte blobData[] = results.getBytes(3);
    System.out.println("Loaded BLOB");
    byte rawData[] = results.getBytes(4);
    System.out.println("Loaded RAW");
    byte longData[] = results.getBytes(5);
    System.out.println("Loaded LONG");
    catch (SQLException e)
    e.printStackTrace();
    results.close();
    stmt.close();
    connection.close();
    } // public class JdbcLongTest

    The problem is that LONGs are not buffered but are read from the wire in the order defined. The problem is the same as
    rs = stmt.executeQuery("select myLong, myNumber from tab");
    while (rs.next()) {
    int n = rs.getInt(2);
    String s = rs.getString(1);
    The above will fail for the same reason. When the statement is executed the LONG is not read immediately. It is buffered in the server waiting to be read. When getInt is called the driver reads the bytes of the LONG and throws them away so that it can get to the NUMBER and read it. Then when getString is called the LONG value is gone so you get an exception.
    Similar problem here. When the query is executed the CLOB and BLOB locators are read from the wire, but the LONG is buffered in the server waiting to be read. When Clob.getString is called, it has to talk to the server to get the value of the CLOB, so it reads the LONG bytes from the wire and throws them away. That clears the connection so that it can ask the server for the CLOB bytes. When the code reads the LONG value, those bytes are gone so you get an exception.
    This is a long standing restriction on using LONG and LONG RAW values and is a result of the network protocol. It is one of the reasons that Oracle deprecates LONGs and recommends using BLOBs and CLOBs instead.
    Douglas

  • Drag and drop the xml schema?

    hi all
    i am creating a GUI. i am using splitpane to split my Frame. and my left split pane contains the XML schema in the form of a JTree. and i need to drag and drop the nodes of a JTree on to right split pane which sub divided in to some regions. i can able to open the xml file in to left split pane as a Jtree. but unable to drag and drop the Nodes in to rightsplit pane.
    any e book or sample code is greatly appriciated.
    thanks in advance.
    karthik

    Hi
    I am new to Oracle but not to VS. I have downloaded and installed the newest tools for Developer, having first tried the install for VS2003.net (which refused to install on my VS 2005.) I got the beta download and installed it, but my oracle explorer shows nothing. Any attempt to add a connection results in an error ORA-12560:TNS:protocol adaptor error. I had the full install of 10g r2 on my notebook, but removed it and opted for the XE version. I removed the Oracle_Home environment variable prior to installing XE. I am trying to connect to the HR database, and the account is unlocked. I saw a reference to the tnsfiles file, and that seems to be the problem, but I don't know what to do about it. Thanks in advance to anyone who can offer help.
    Bruce
    [email protected]

  • Valid and well Formed XML Schema

    OK I have a project that takes in a xml doc and a xml schema and checks if doc if valid for given schema
    how do i check if a xml schema doc is well formed and valid on its own

    Thanks very much for you reply.
    Howcome in the tool XMLSpy when you create a schema you can check it its both well formed, well thats ok
    and valid? you dont specify the xml doc.
    I have code written that accepts a shema and instance doc and that works grand.
    Just a general question.
    Thanks.

  • Error when deleting and registering an xml schema

    Why do I get an error saying that my schema 'xsd/Envelope.xsd' already exists when I try to register it and yet I cannot delete it and it does not exist in the USER_XML_SCHEMAS table?
    SQL> declare
    2 begin
    3 dbms_xmlschema.deleteSchema('xsd/Envelope.xsd', dbms_xmlschema.DELETE_CASCADE_FORCE);
    4 end;
    5 /
    declare
    ERROR at line 1:
    ORA-31000: Resource 'xsd/Envelope.xsd' is not an XDB schema document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 100
    ORA-06512: at line 3
    SQL> declare
    2 begin
    3 DBMS_XMLSCHEMA.registerSchema('xsd/Envelope.xsd', xdbURIType('/sys/schemas/REITDIST/xsd/Envelope.xsd').getClob(), TRUE, TRUE, FALSE, FALSE);
    4 end;
    5 /
    declare
    ERROR at line 1:
    ORA-31085: schema "xsd/Envelope.xsd" already registered
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 3
    SQL> select SCHEMA_URL, local, qual_schema_url
    2 from user_xml_schemas;
    no rows selected

    dbms_xmlSchema.registerSchema
         SCHEMAURL     => <your xsd name>,
         SCHEMADOC     => <your xsd>,
         LOCAL          => TRUE,
         GENTYPES     => TRUE,
         GENTABLES     => FALSE,
         FORCE          => TRUE,
    If parameter called "force" is set to TRUE, the schema registration will not raise errors. Instead, it creates an invalid XML schema object in case of any errors. By default, the value of this parameter is FALSE (http://download-uk.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_xmlsch.htm#i1003177)

  • CLOB and LONG datatypes

    I have a problem with needing to display fields in a report that are stored in the database as CLOB.
    The report isn't too complicated, and can be put together using folders in Admin.
    There is a table in the database that stores text from reports. Each report is identified by its case id, and then there may be a number of reports for each case (let's say 1-5 for the purposes of this explaination). There will then be three sections of text in each report, identifed in the database by section numbers.
    The fields needed are the case number (case_id), the report number (report_no), the section number (sect_no) and the section text (sect_text)
    All of the fields are numeric, except sect_text, which is a CLOB datatype.
    There are two queries, one to select the case id, min report number and first section of text and the other to select the case id, max report number and last section of text. The aim being a report that shows the start of the first report and the end of the last one.
    So, that's the background. All of the queries to select the data work fine in sqlplus. However they can't be displayed in Disco because it brings in CLOB fields as LONG, and can't group them (which it has to do for the MAX and MIN)
    I'd rather not set the whole thing up as a view on the DB, as I'd prefer to have the flexibiility of editing it in discoverer
    Any tips?

    Hi
    I do have a tip. Please take a look at this thread that I was involved in a couple of years ago:
    CLOB show up as item
    And here is another one that might help:
    Possible for Discoverer to display BLOB type documents stored in database?
    Best wishes
    Michael

  • Syndication mapping when changing XML schema

    I have used a ARTMAS04 XML schema and done mapping in the syndicator and saved the map. Then we are doing changes i SAP R/3 and need to add some extentions in the IDOC and therefor also the XML schema. I then add my new schema with the extentions into the the syndicator, and try to open the mapping. Then the mapping is done using the old schema. This means that if I do a change in an XML schema, I need to to map everything from scratch. Does anyone have a solution to this problem?
    Regards John-Kjell

    Hi John,
    The maps saves not only the mappings but also the destination properties for that particular scenario.
    Hence as soon as you change the destination properties i.e your XML schema, and try to open your old map which is using different XML schema your changes will be lost and you will end up with using old XML schema only.
    As far as i know, to handle this situation you have to do all the mappings again.
    Hope this helps.
    Regards,
    Pooja

  • Using xml schema problem (SAP MDM 7.1 Syndicator)

    Good day !
    I try to syndicate directory which correspond to some xml-schema and I have a problem.
    I want to syndicate data from hierarchy table  which have one field which have a type like lookup <Flat> (multivalued).
    In XML-schema element "DEF_PRODUCT" and "DEF_PRODUCT_CODE" - attribute presents hierarchy table.
    "CREDIT_PRODUCT" and childs presents  linked flat table.
    According idea and business rules I must get the result like this: each  "DEF_PRODUCT" have N-"CREDIT_PRODUCT". One - to- many.
    But when I set up all map completely and look to xml result file I start to be disappointed.
    XML result file approximately must be like this: 
    <DEF_PRODUCT>
        <CREDIT_PRODUCT/>
        <CREDIT_PRODUCT/>
        <CREDIT_PRODUCT/>
    </DEF_PRODUCT>
    but in result I have all <CREDIT_PRODUCT>  in one node and child attributes.
    I attach 3 pics which explain my situation.
    xml-schema :[http://xmages.net/storage/10/1/0/6/3/upload/42ca6ca8.jpg]
    field mapping: [http://xmages.net/storage/10/1/0/6/a/upload/bbbc09f2.jpg]
    example: [http://xmages.net/storage/10/1/0/c/c/upload/817b0e23.jpg]
    Anybody can help me?
    About software : SAP MDM 7.1 (7.1.04.139)
    P.S: My problem can be resolved succesfully if I will use 1 <main> table and 1 <qualified flat> table.
           But in my case I must use hierarchy - structure because it  most usable for business - users

    >
    Christian Heuer wrote:
    > Hi,
    >
    > now I understood and you really have got a point here. But the question is whether you need key mapping then on the remote key level with a tuple anymore. If yes, you won
    >
    > Best regards
    > Christian
    If SAP MDM will present many opportunities to me I will be very glad.
    I repeat I must get output xml which have the pair like "RemoteKey"="RemoteSystem" in tuple subnode.
    In tuple, after your advices.
    Ideally, Syndicator must present to each user ability to choose pair "RemoteKey" = "RemoteSystem" in each subnode like <LookUp> table in root (look at my example pic).
    Imagine  you have one root table and N-linked <lookup> tables.
    Tree like this :
    <main tbl>
      <subtbl1/>
      <subtbl2/>
      <subtbl3>
         <childtbl1/>
         <childtbl2/>
      </subtbl3>
    </main tbl>
    It's dangerous to deprive SAP MDM user to select  pair "RemoteKey" = "RemoteSystem" from ROOT to ALL and LAST LEAF in abstract hierarchy. How do you think ?
    Now, I haven't abilities to solve my problem using standard resources. Really ?

  • Autotype from XML schema problems

    Hello,
    I am trying to autotype the following Xml schema:
    http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3
    My build.xml contains:
    <target name="autotype" >
         <autotype
              schemaFile="REL-5-MM7-1-3.xsd"
              targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
              packageName="com.foo"
              keepGenerated = "True"
              destDir="output" />
    </target>
    1.
    I run using ant but it fails..
    SubmitRspTypeCodec.java:15: cannot resolve symbol
    [autotype] symbol : class GenericResponseTypeCodec
    [autotype] location: package soap
    [autotype] extends javax.xml.soap.GenericResponseTypeCodec
    weblogic.webservice.tools.build.WSBuildException: Failed to do type mapping -
    with nested exception:
    [weblogic.xml.schema.binding.BindingException: ERROR: during code compilation
    - with nested exception:
    [java.io.IOException: Compiler failed executable.exec]]
    The interesting point is when i deleted following 3 lines from schema (line 413
    to 415 in REL-5-MM7-1-3.xsd),
    <xs:sequence>
         <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    no compile error is thrown.
    2.
    But the weird thing is that some of classes are not generated, for example SubmitReqType,
    ReplaceReqType. This is because they reference RelativeOrAbsoluteDateType (line
    367). And RelativeOrAbsoluteDateType contains the following union definition:
    <xs:union memberTypes="xs:dateTime xs:duration"/>
    i think that this union definition might cause problem but neither an error nor
    a warning message is submitted from ant. It says successful but missing classes.
    I am struggling with these 2 problems for days, any help would be appreciated.
    Thanks,
    aLi

    Hi Ali,
    I suspect that the reason you are having this problem is covered in the following
    link:
    http://e-docs.bea.com/wls/docs81/webserv/overview.html#1074641
    I guess my question is, what else do you have in the build.xml that uses (or attempts
    to use) the autotype Ant task? Are you trying to build a client (i.e. a JAX-RPC
    static stub) for a web service? Is this for a WebLogic Web Service you want to
    build? Or are you just trying to see if autotype can process the .xsd file, in
    question? If so, the above link states why it currently won't work.
    One alternative option, is to use a Workshop Schema project (or XMLBeans) to process
    the .xsd file. I just did that, and it worked fine :-)
    Regards,
    Mike Wooten
    "Ali Pakkan" <[email protected]> wrote:
    >
    Hello,
    I am trying to autotype the following Xml schema:
    http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3
    My build.xml contains:
    <target name="autotype" >
         <autotype
              schemaFile="REL-5-MM7-1-3.xsd"
              targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
              packageName="com.foo"
              keepGenerated = "True"
              destDir="output" />
    </target>
    1.
    I run using ant but it fails..
    SubmitRspTypeCodec.java:15: cannot resolve symbol
    [autotype] symbol : class GenericResponseTypeCodec
    [autotype] location: package soap
    [autotype] extends javax.xml.soap.GenericResponseTypeCodec
    weblogic.webservice.tools.build.WSBuildException: Failed to do type mapping
    with nested exception:
    [weblogic.xml.schema.binding.BindingException: ERROR: during code compilation
    - with nested exception:
    [java.io.IOException: Compiler failed executable.exec]]
    The interesting point is when i deleted following 3 lines from schema
    (line 413
    to 415 in REL-5-MM7-1-3.xsd),
    <xs:sequence>
         <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    no compile error is thrown.
    2.
    But the weird thing is that some of classes are not generated, for example
    SubmitReqType,
    ReplaceReqType. This is because they reference RelativeOrAbsoluteDateType
    (line
    367). And RelativeOrAbsoluteDateType contains the following union definition:
    <xs:union memberTypes="xs:dateTime xs:duration"/>
    i think that this union definition might cause problem but neither an
    error nor
    a warning message is submitted from ant. It says successful but missing
    classes.
    I am struggling with these 2 problems for days, any help would be appreciated.
    Thanks,
    aLi

  • XML Schema Component Naming Convention

    Is there a naming convention when you create an XML Schema? For example,
    When you create a Type component, then the first letter of its name should be upper case ie. BMW, Honda, AutombileEngine ...etc.
    When you create an Element component, then the first letter of its name is lowercase ie. engine, car, guestCar ..etc.
    Do we have such naming convention for XML Schema?
    Thanks

    I am giving this from my document which i prepared for one of my customer
    2     General Guidelines for design of XML schema documents
    The representation of data in an XML format will be a key component of development within SOA. Therefore, the design and development of XML schemas should be as rigorous an activity as designing and developing code or designing database schemas. As such, when creating an XML schema you should be working within a development process and working to a set of design guidelines and coding standards (when writing the XML schema file). XML schemas should be reviewed for accuracy and compliance with guidelines and standards. Each of the requirements in the list below is a general requirement for all XML schemas to be deployed in the SOA environment.
    •     Understandable: XML schemas should be clear, consistent and unambiguous. They should contain human readable documentation and, where appropriate, links to requirements or design documents.
    •     Semantically Complete: An XML schema should define, for one or more target XML documents, each and every element and attribute that is understood by your solution when processing target documents.
    •     Constraining: XML schemas are used as contracts between both publisher and consumer. As such, they must be able to be validated as concisely as possible. When designing an XML schema constraints should be identified for the values for all the elements and attributes that the application uses and relies on to the set of values that the application can handle. A valid document should imply valid data within the limits of what can be specified by the XML Schema language.
    •     Uniquely identifiable: XML schemas should import and include other XML schema files rather than duplicating types and elements locally.
    •     Reusable: XML schemas should be specified in such a way that types and other XML schemas can leverage elements. Every type defined in an XML schema that is the content type of an attribute or an element should be defined globally (i.e., at the top level in the Schema). Types that are defined globally can be reused in other XML schemas. Schemas should be separated into logical sections which can be included into the main schema file.
    •     Extensible: Schemas should be designed to be extensible—that is, new elements and attributes can be inserted throughout the document.
    Every schema should use at least two namespaces – the targetNamespace and the XML Schema (http://www.w3.org/2001/XMLSchema) namespace.
    Create typed elements that can be referred to by object elements:
    Example:
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.soa.com"
    xmlns="http://www.soai.com"
    elementFormDefault="qualified">
    <xsd:complexType name="PersonType">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="SSN" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.company.org"
    xmlns="http://www.company.org"
    elementFormDefault="qualified">
    <xsd:include schemaLocation="Person.xsd"/>
    <xsd:include schemaLocation="Product.xsd"/>
    <xsd:element name="Company">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Person" type="PersonType" maxOccurs="unbounded"/>
    <xsd:element name="Product" type="ProductType" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    •     Recognize that with XML Schemas you will not be able to express all your business rules.
    o     Express those business rules using XSLT.
    •     Use type definitions
    Elements vs Attributes
    •     Use attributes for metadata about the parent element.
    •     Use attributes for data that is semantically tied to the enclosing element.
    •     Use elements for data that have a meaning separate from the enclosing element.
    •     Use attributes when the value will be frequently present in order to improve the human readable form of an XML instance document or reduce its size.
    •     If you don't know which to use, then use the element form (which is more extensible).
    2.1.1     Element, Types and attribute names
    Create a descriptive name without it being excessively long (no more than 32 characters).
    Elements and Types should be named in Upper Camel Case. Upper Camel Case capitalizes the first character of each word and compounds the name (remove all whitespace).
    Attributes should be named in Lower Camel Case. Lower Camel Case capitalizes the first character of each word except the first word and compounds the name.
    Simple and Complex type names
    XML Schema has separate symbol space for elements and types so they may have the same name. The best practice is to append the word "Type" to all simple and complex type names to aid in human readability and comprehension.
    Element, attribute and type names MUST be in a singular form unless the concept itself is plural.
    2.1.1.1     XML Schema versioning
    Use major and minor version tracking:
    Major—completely different structure and semantics, most likely not backward compatible
    Minor—backward compatible changes which introduce new features without removing or changing the semantics of existing structures
    2.1.1.2     Indication of version in the namespace URI
    Specify a namespace URI as follows
    http://$domain/$groupSpecifier/$namespaceTitle/$version
    The groupSpecifier can include several levels, e.g., /www.soa.com/SOA/USA/.
    An example namespace could be:
    http://www.soa.com/SOA/order/2

  • Help In XML schema using  oracle 10g

    i want to give seminar in XML schema using oracle 10g. n i m very new in this topic. so help me out which topic i include & any document regarding this

    XML Schema has various aspects.
    1. Creating an XML Schema, which may be done in JDeveloper.
    2. Initializing an XML document from an XML Schema, which may also be done in JDeveloper.
    For creating and initializing an XML Schema please refer
    http://www.regdeveloper.co.uk/2007/10/01/build_xml_schema_jdeveloper/
    3. Validating an XML document with an XML Schema.
    http://www.oracle.com/technology/pub/articles/vohra_xmlschema.html

  • Using XML schema in a Java application

    Hi,
    I need to parse and use an XML schema in an application, mainly for helping a user to build an XPATH.
    For that, I want to use the Schema classes bundled with Oracle's parser. Is there any documentation about that ? Or are the source code available ?
    Thank's
    Phil.

    See the JavaHelp article on my site.
    I had developers saying they had to have JavaHelp for their
    Java application. After discussion we established that for where
    this was going to be used, webhelp was just as acceptable. Being
    easier for us that won the day.

  • Append new tag in xml schema

    Hi,
               I have created a local varibale and stored my xml schema (xml structure) in it. I am using a sql query to fetch the records from databae and populating it to the schema using Assignment action block. But I have a requirement that one of the tag in the xml schema should be added dynamicaly according to the result of the query. Can anyone help me on this? . In the Linktype I saw one option as Append xml. How can we use that option
    Please let me know if you have any thoughts on this
    Thanks in advance
    Shaji

    Hi Shaji,
    Please find the below link: It explains all the XML functions in MII Workbench.
    http://wbhelp.sap.com/manufacturing/xmii_120/en/44/7ca00d32406572e10000000a11466f/content.htm
    "Calculated Columns" can be useful here as per your requirements.
    For help on Link Types, go through the following link:
    http://wbhelp.sap.com/manufacturing/xmii_120/en/44/89aa7088cc6fb5e10000000a155369/content.htm
    Hope this will help you.
    Best regards,
    Kedar

  • How to extract data from CLOB and insert them into DB?

    Hi PL/SQL Gurus,
    I have no experience in PL/SQL, but I have a requirement now where I have to use it.
    We have a table with 10 columns, one of them is a CLOB and it holds XML data. The XMLs are very huge in size.
    Two new columns are added to the table and the data has to be filled for the existing records from the corresponding XML. The XML has all the data as attributes. I started searching on the internet and tried if I could extract the data out of XML.
    SELECT extractValue(value(x), '/Order/Package/@Code',
    'xmlns:ns0="http://mycompany.com/Order/OrderType.xsd"' )
    FROM ORDER_TABLE A
    , TABLE(
    XMLSequence(
    extract(
    xmltype(A.XML_DATA)
    , '/ns0:Root'
    , 'xmlns:ns0="http://mycompany.com/Order/OrderType.xsd"'
    ) x;
    But this isn't working. Could anyone please provide some ideas.
    I just want to confirm that I am able to extract data. Once this is done I would like to create a procedure so that all the existing records can be updated.
    Thanks in advance.
    Regards,
    Fazzy

    Can this be acheived using a SQL statement.Yes, you can do it with the DML error logging clause.
    Here's a quick example I've just set up :
    Base table
    SQL> create table order_table (
      2   order_id number,
      3   package_code varchar2(30),
      4   package_desc varchar2(100),
      5   xml_data clob
      6  );
    Table created
    SQL> alter table order_table add constraint order_table_pk primary key (order_id);
    Table altered
    Adding data...
    SQL> insert into order_table (order_id, xml_data)
      2  values (1, '<?xml version="1.0" encoding="UTF-8"?>
      3  <ns0:Root xmlns:ns0="http://mycompany.com/Order/OrderType.xsd" BookingDate="2009-06-07">
      4  <ns1:OrderKey xmlns:ns1="http://mycompany.com/Order/OrderKeyTypes.xsd" SystemCode="THOMAS" Id="458402-TM1" Version="1"/>
      5  <ns0:Package Code="0001" Desc="ProductName1"/>
      6  <ns0:PromotionGroup Code="DSP" Name="OrderThomasPortal"/>
      7  <ns0:Promotion Code="TH902" Name="OrderThomasPortal" SellingName="OrderThomasPortal" BackOfficeName="OrderThomasPortal"/>
      8  <ns0:FinancialSupplier Code="HHT" Name="NYOrdSupp"/>
      9  <ns0:SellingCurrency Code="EUR" Name="Euro"/>
    10  <ns0:Owner ClientId="02654144" ClientMandator="T" ClientSystem="ROSY"/>
    11  <ns0:Agent PersonInAgency="5254" AgentCode="000009" CommissionAmount="2.8" CommissionDueDate="2009-07-01+02:00" VatOnCommission="0"/>
    12  </ns0:Root>');
    1 row inserted
    SQL> insert into order_table (order_id, xml_data)
      2  values (2, '<?xml version="1.0" encoding="UTF-8"?>
      3  <ns0:Root xmlns:ns0="http://mycompany.com/Order/OrderType.xsd" BookingDate="2009-06-07">
      4  <ns1:OrderKey xmlns:ns1="http://mycompany.com/Order/OrderKeyTypes.xsd" SystemCode="THOMAS" Id="458402-TM1" Version="1"/>
      5  <ns0:Package Code="0002" Desc="ProductName2/>
      6  <ns0:PromotionGroup Code="DSP" Name="OrderThomasPortal"/>
      7  <ns0:Promotion Code="TH902" Name="OrderThomasPortal" SellingName="OrderThomasPortal" BackOfficeName="OrderThomasPortal"/>
      8  <ns0:FinancialSupplier Code="HHT" Name="NYOrdSupp"/>
      9  <ns0:SellingCurrency Code="EUR" Name="Euro"/>
    10  <ns0:Owner ClientId="02654144" ClientMandator="T" ClientSystem="ROSY"/>
    11  <ns0:Agent PersonInAgency="5254" AgentCode="000009" CommissionAmount="2.8" CommissionDueDate="2009-07-01+02:00" VatOnCommission="0"/>
    12  </ns0:Root>');
    1 row inserted
    SQL> commit;
    Commit complete
    {code}
    Note that the second row inserted contains a not well-formed XML (no closing quote for the /Root/Package/@Desc attribute).
    *Creating the error logging table...*
    {code}
    SQL> create table error_log_table (
      2   ora_err_number$ number,
      3   ora_err_mesg$   varchar2(2000),
      4   ora_err_rowid$  rowid,
      5   ora_err_optyp$  varchar2(2),
      6   ora_err_tag$    varchar2(2000)
      7  );
    Table created
    {code}
    *Updating...*
    {code}
    SQL> update (
      2    select extractvalue(doc, '/ns0:Root/ns0:Package/@Code', 'xmlns:ns0="http://mycompany.com/Order/OrderType.xsd"') as new_package_code
      3         , extractvalue(doc, '/ns0:Root/ns0:Package/@Desc', 'xmlns:ns0="http://mycompany.com/Order/OrderType.xsd"') as new_package_desc
      4         , package_code
      5         , package_desc
      6    from (
      7      select package_code
      8           , package_desc
      9           , xmltype(xml_data) doc
    10      from order_table t
    11    )
    12  )
    13  set package_code = new_package_code
    14    , package_desc = new_package_desc
    15  log errors into error_log_table ('My update process')
    16  reject limit unlimited
    17  ;
    1 row updated
    SQL> select order_id, package_code, package_desc from order_table;
      ORDER_ID PACKAGE_CODE                   PACKAGE_DESC
             1 0001                           ProductName1
             2                               
    {code}
    One row has been updated as expected, the other has been rejected and logged into the error table :
    {code}
    SQL> select * from error_log_table;
    ORA_ERR_NUMBER$ ORA_ERR_MESG$                                                                    ORA_ERR_ROWID$     ORA_ERR_OPTYP$ ORA_ERR_TAG$
              31011 ORA-31011: XML parsing failed                                                    AAAF6PAAEAAAASnAAB U              My update process
                    ORA-19202: Error occurred in XML processing                                                                       
                    LPX-00244: invalid use of less-than ('<') character (use &lt;)                                                    
                    Error at line 5                                                                                                   
                    ORA-06512: at "SYS.XMLTYPE", line 272                                                                             
                    ORA-06512: at line 1                                                                                              
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • File Adapter strips XML Schema content?

    I'm currently using WLI 7.0 and the File Adapter. When I create an event through
    WLAI and attach my xml schema, WLAI is stripping values from my schema. Is this
    by design?
    Node before import:
    <xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded">
    Node after import:
    <xsd:any minOccurs="0" maxOccurs="unbounded">
    The processContents value is very important since I don't want validation to occur
    on this node. Any ideas?
    Thanks.

    I'm currently using WLI 7.0 and the File Adapter. When I create an event through
    WLAI and attach my xml schema, WLAI is stripping values from my schema. Is this
    by design?
    Node before import:
    <xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded">
    Node after import:
    <xsd:any minOccurs="0" maxOccurs="unbounded">
    The processContents value is very important since I don't want validation to occur
    on this node. Any ideas?
    Thanks.

Maybe you are looking for

  • Split Tunnel VPN and routing public ip traffic

    Hi Everyone,     I have my split tunnel vpn working well but I need to make an adjustment. We have a few systems in the "cloud" and we only allow access from our corporate WAN IP to those servers. I need to be able to access those servers via VPN con

  • I want my phone to do this...

    just got a 3GS moved from a windows mobile phone and there are a few things that seems to be missing and it's aggrevating me. 1. email accounts using pop servers I can't make a new folder. I want to create a new folder so I can save emails but not ke

  • Consistenly "too many arguments" when OCR any scanned PDF file in Adobe Acrobat 9.2

    Hi, plz see attached file for a 2 page sample. I have purchased AA9 to get better OCR (clearscan). Before, we were using AA6, which sometimes crashed, but not consistently. However, AA9 (9.2.0) now always crashes with the same error "too many argumen

  • Games windows minimized using FX 5200

    I have bought a MSI Geforce FX 5200 card (128 MB) less than a year ago. I noticed when I want to play games like Need for Speed underground, the game starts and is immediately minimized. There is no way I am able to maximize the game window.     Have

  • Org structure migration in HR

    Hi All , Whats the best method proceeding with HR migration , I can go for lsmw using recording . Thanks in ADV