Help in sql xml

sorry i am new in the oracle xmldb features.
i need help with a select statement on a xmltype column.
my table:
CREATE TABLE ESHOP_CUSTOMER_BASKET
BSK_ID INTEGER,
BSK_CUSTOMER_GID VARCHAR2(10 BYTE),
BSK_STATUS INTEGER DEFAULT 0,
BSK_ORDER_DETAIL XMLTYPE,
BSK_SESSION_ID VARCHAR2(50 BYTE),
BSK_DAT_ERST DATE DEFAULT sysdate,
BSK_VALID_TO DATE
In the colum bsk_order_detail are xml documents like this:
<?xml version="1.0" encoding="UTF-8"?>
<shoppingcart>
<master>
<art_id>278</art_id>
<art_name>04/30/2007 Event XYZ</art_name>
<description>04/30/2007 Event XYZ</description>
<quantity>1</quantity>
<onetime>199</onetime>
<permanent>0</permanent>
<currency>EUR</currency>
<child>
<art_id>19</art_id>
<art_name>AKZENT Congresshotel</art_name>
<description>AKZENT Congresshotel</description>
<quantity>2</quantity>
<onetime>90</onetime>
<permanent>0</permanent>
<currency>EUR</currency>
</child>
<child>
<art_id>20</art_id>
<art_name>Breakfast</art_name>
<description>Breakfast</description>
<quantity>2</quantity>
<onetime>20</onetime>
<permanent>0</permanent>
<currency>EUR</currency>
</child>
</master>
</shoppingcart>
I need a view that give me a listing of art_id and quantity:
art_id | quantity
278 | 1
19 | 2
20 | 2
Can someone help me with this?
thanks markus

I still don't like the solution, but last week I couldn't find a better solution like the one you are suggesting:
SQL> CREATE TABLE ESHOP_CUSTOMER_BASKET
  2  (
  3  BSK_ID INTEGER,
  4  BSK_CUSTOMER_GID VARCHAR2(10 BYTE),
  5  BSK_STATUS INTEGER DEFAULT 0,
  6  BSK_ORDER_DETAIL XMLTYPE,
  7  BSK_SESSION_ID VARCHAR2(50 BYTE),
  8  BSK_DAT_ERST DATE DEFAULT sysdate,
  9  BSK_VALID_TO DATE
10  );
Table created.
SQL> insert into ESHOP_CUSTOMER_BASKET (bsk_order_detail)
  2  values
  3  ('<?xml version="1.0" encoding="UTF-8"?>
  4  <shoppingcart>
  5  <master>
  6  <art_id>278</art_id>
  7  <art_name>04/30/2007 Event XYZ</art_name>
  8  <description>04/30/2007 Event XYZ</description>
  9  <quantity>1</quantity>
10  <onetime>199</onetime>
11  <permanent>0</permanent>
12  <currency>EUR</currency>
13  <child>
14  <art_id>19</art_id>
15  <art_name>AKZENT Congresshotel</art_name>
16  <description>AKZENT Congresshotel</description>
17  <quantity>2</quantity>
18  <onetime>90</onetime>
19  <permanent>0</permanent>
20  <currency>EUR</currency>
21  </child>
22  <child>
23  <art_id>20</art_id>
24  <art_name>Breakfast</art_name>
25  <description>Breakfast</description>
26  <quantity>2</quantity>
27  <onetime>20</onetime>
28  <permanent>0</permanent>
29  <currency>EUR</currency>
30  </child>
31  </master>
32  </shoppingcart>')
33  ;
SQL> select art1.* from
  2  ESHOP_CUSTOMER_BASKET,
  3  xmltable
  4  (
  5  '/shoppingcart/master'
  6  passing bsk_order_detail
  7  columns
  8  artid varchar2(10) path '/master/art_id',
  9  artqty number path '/master/quantity'
10  ) art1
11  union
12  select art1.* from
13  ESHOP_CUSTOMER_BASKET,
14  xmltable
15  (
16  '/shoppingcart/master/child'
17  passing bsk_order_detail
18  columns
19  artid varchar2(10) path '/child/art_id',
20  artqty number path '/child/quantity'
21  ) art1
22  ;
ARTID         ARTQTY
19                 2
20                 2
278                1
3 rows selected.

Similar Messages

  • How do I create an undeclared namespace node with sql/xml?

    I have to interact with a .NET web service that is expecting to have an xml node with an undeclared namespace, i.e. <address xmlns=""> I figured that I could create this by using XMLATTRIBUTES ( '' AS "xmlns") but a null attribute will not be added to the attribute listing. This works fine for other xmlns entries that contain values. Without this undeclared namespace node, the web service reports an Internal SOAP failure message, so I have to include it. Do I have to resort to manually injecting this null attribute via DOM after I produce the xml? I'm using SQL/XML query generate the xml as a view which gives me the entire packet for this document/literal web service OTHER THAN this missing undeclared namespace element.
    Any tips/suggestions would be helpful! Thanks a bunch, and have a Happy Holiday Season.
    Eric

    You can use UTL_RAW package.
    First, convert string to raw with UTL_RAW.CAST_TO_RAW, then using UTL_RAW.CONVERT to convert raw to utf-8 and finally UTL_RAW.CAST_TO_VARCHAR to get utf-8 string.
    Regards

  • PL/SQL XML Parser demo

    i've downloaded the Pl/SQL XML parser demo - xslsample / domsample - followed the guide , etc but I'm getting ....
    BEGIN xslsample ('/export/home/oracle/plmx/sample','family.xml','iden.xsl','family.out','errors.txt'); END;
    ERROR at line 1:
    ORA-29516: Aurora assertion failure: Assertion failure at eox.c:187
    Uncaught exception Root of all Java exceptions:
    ORA-06512: at "PLMX.XMLPARSERCOVER", line 0
    ORA-06512: at "PLMX.XMLPARSER", line 57
    ORA-06512: at "PLMX.XSLSAMPLE", line 28
    ORA-06512: at line 1
    anybody seen this ??

    There is no such limit on our Parser for PL/SQL. Could you
    perhaps be using the PLXML Utilities? If you are you might try
    our PL/SQL Parser instead.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Premal Mehta (guest) wrote:
    : Hi
    : I am using PL/SQL XML Parser to add XML data in database. I
    : am having trouble when using file sixe greater than 500KB?
    : What is the alternative? Can I do something to process
    larger
    : files?
    : Please Help, this is quite urgent.
    : Hoping for help,
    : Premal.
    null

  • Accessing online help in Sql developer

    For some reason I have lost the ability to access Help in Sql Developer. Nothing happenx when I click on the "Table of Contents" in the Help menu. I un and re installed Sql Developer, but thie problem remains.
    My OS is vista 32 bit.
    Thanks
    Mewbie

    There's a +\sqldeveloper\system1.5.1.54.40\o.ide.11.1.1.0.22.49.42\windowinglayout.xml+ under your user profile. Deleting that should revert illegal positions (as it may have got pushed off screen).
    You can also delete the whole +\sqldeveloper+ folder (or selective subfolders) to reset everything to factory defaults...
    Hope that helps,
    K.

  • Re-Write the Node-DOM code with SQL-XML funtions

    Hi Friends,
    Could you please help in re-writing the below code using SQl-XML functions
    DECLARE
    l_domdoc dbms_xmldom.DOMDocument;
    l_xmltype XMLTYPE;
    l_root_node dbms_xmldom.DOMNode;
    l_departments_node dbms_xmldom.DOMNode;
    l_dept_element dbms_xmldom.DOMElement;
    l_dept_node dbms_xmldom.DOMNode;
    l_name_node dbms_xmldom.DOMNode;
    l_name_textnode dbms_xmldom.DOMNode;
    l_location_node dbms_xmldom.DOMNode;
    l_location_textnode dbms_xmldom.DOMNode;
    l_employees_node dbms_xmldom.DOMNode;
    l_emp_element dbms_xmldom.DOMElement;
    l_emp_node dbms_xmldom.DOMNode;
    l_emp_first_name_node dbms_xmldom.DOMNode;
    l_emp_first_name_textnode dbms_xmldom.DOMNode;
    l_emp_last_name_node dbms_xmldom.DOMNode;
    l_emp_last_name_textnode dbms_xmldom.DOMNode;
    BEGIN
    -- Create an empty XML document
    l_domdoc := dbms_xmldom.newDomDocument;
    -- Create a root node
    l_root_node := dbms_xmldom.makeNode(l_domdoc);
    -- Create a new node Departments and add it to the root node
    l_departments_node := dbms_xmldom.appendChild( l_root_node
    , dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Deptartments' ))
    FOR r_dept IN (SELECT dept.department_id
    , dept.department_name
    , loc.city
    FROM departments dept
    JOIN locations loc
    ON loc.location_id = dept.location_id
    WHERE dept.department_id IN (10,20)
    LOOP
    -- For each record, create a new Dept element with the Department ID as attribute.
    -- and add this new Dept element to the Departments node
    l_dept_element := dbms_xmldom.createElement(l_domdoc, 'Dept' );
    dbms_xmldom.setAttribute(l_dept_element, 'Deptno', r_dept.Department_Id );
    l_dept_node := dbms_xmldom.appendChild( l_departments_node
    , dbms_xmldom.makeNode(l_dept_element)
    -- Each Dept node will get a Name node which contains the department name as text
    l_name_node := dbms_xmldom.appendChild( l_dept_node
    , dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Name' ))
    l_name_textnode := dbms_xmldom.appendChild( l_name_node
    , dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_dept.department_name ))
    -- Each Dept node will aslo get a Location node which contains the location(city) as text
    l_location_node := dbms_xmldom.appendChild( l_dept_node
    , dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Location' ))
    l_location_textnode := dbms_xmldom.appendChild( l_location_node
    , dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_dept.city ))
    -- For each department, add an Employees node
    l_employees_node := dbms_xmldom.appendChild( l_dept_node
    , dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Employees' ))
    FOR r_emp IN (SELECT employee_id
    , first_name
    , last_name
    FROM employees
    WHERE department_id = r_dept.department_id
    LOOP
    -- For each record, create a new Emp element with the Employee ID as attribute.
    -- and add this new Emp element to the Employees node
    l_emp_element := dbms_xmldom.createElement(l_domdoc, 'Emp' );
    dbms_xmldom.setAttribute(l_emp_element, 'empid', r_emp.employee_id );
    l_emp_node := dbms_xmldom.appendChild( l_employees_node
    , dbms_xmldom.makeNode(l_emp_element)
    -- Each emp node will get a First name and Last name node which contains the first name and last name as text
    l_emp_first_name_node := dbms_xmldom.appendChild( l_emp_node
    , dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'FirstName' ))
    l_emp_first_name_textnode := dbms_xmldom.appendChild( l_emp_first_name_node
    , dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_emp.first_name ))
    l_emp_last_name_node := dbms_xmldom.appendChild( l_emp_node
    , dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'LastName' ))
    l_emp_last_name_textnode := dbms_xmldom.appendChild( l_emp_last_name_node
    , dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_emp.last_name ))
    END LOOP;
      END LOOP;
    l_xmltype := dbms_xmldom.getXmlType(l_domdoc);
    dbms_xmldom.freeDocument(l_domdoc);
    dbms_output.put_line(l_xmltype.getClobVal);
    END;
    thanks and regards,
    Arun Thomas T

    It's as easy as this :
    SQL> select xmlserialize(document
      2           xmlelement("Departments"
      3           , xmlagg(
      4               xmlelement("Dept"
      5               , xmlattributes(d.department_id as "Deptno")
      6               , xmlforest(
      7                   d.department_name as "Name"
      8                 , l.city as "Location"
      9                 )
    10               , xmlelement("Employees"
    11                 , (
    12                     select xmlagg(
    13                              xmlelement("Emp"
    14                              , xmlattributes(e.employee_id as "empid")
    15                              , xmlforest(
    16                                  e.first_name as "FirstName"
    17                                , e.last_name as "LastName"
    18                                )
    19                              )
    20                            )
    21                     from hr.employees e
    22                     where e.department_id = d.department_id
    23                   )
    24                 )
    25               )
    26             )
    27           )
    28           indent
    29         )
    30  from hr.departments d
    31       join hr.locations l on l.location_id = d.location_id
    32  where d.department_id in (10,20) ;
    XMLSERIALIZE(DOCUMENTXMLELEMEN
    <Departments>
      <Dept Deptno="10">
        <Name>Administration</Name>
        <Location>Seattle</Location>
        <Employees>
          <Emp empid="200">
            <FirstName>Jennifer</FirstName>
            <LastName>Whalen</LastName>
          </Emp>
        </Employees>
      </Dept>
      <Dept Deptno="20">
        <Name>Marketing</Name>
        <Location>Toronto</Location>
        <Employees>
          <Emp empid="201">
            <FirstName>Michael</FirstName>
            <LastName>Hartstein</LastName>
          </Emp>
          <Emp empid="202">
            <FirstName>Pat</FirstName>
            <LastName>Fay</LastName>
          </Emp>
        </Employees>
      </Dept>
    </Departments>

  • Strange Behavior with SQL/XML

    Our University have had for quite some time now a rather difficult situation with a very significant course handbook web site that creates HTML based on database XSL transformation of XML content generated with SQL/XML. The database is 10.2.0.2.0. The HTML is passed via a distributed database link to an Oracle Portal dynamic portlet for display. Some of the derived XML originates from XML Schema registered instance documents and some from relational storage.
    Let me explain. Occasionally after a period of operating (could be one week, sometimes even less) we will experience a problem whereby our derived XML content (just prior to PL/SQL database XSL transformation) will develop a parsing problem. Once this happens to one XSL transform of a course then subsequently it happens for every course viewed/transformed there-after.
    Recently I experienced the problem and then added the XMLNS argument to the extract function. That seemed to fix things and I thought I had it licked.
    Today we started to get the same problem again. The error reported was:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00242: invalid use of ampersand ('&') character (use &amp;)
    Error at line 1
    Now this might have been reasonable for one course. But every course reported the same problem there-after without fail. I managed to fix the issue but in a way that really doesn't seem to make sense. What I did was to alter the SQL/XML statement by adding in an extra XMLEMENT and then to recompile the function that returns an XMLTYPE based on the execution of the SQL statement. After compiling the function everything returned to normal.
    This doesn't seem to make sense.
    I am pretty desperate for help on this. I really don't know how to progress the solution. I don't get much joy from Oracle Support as our application covers too many high tech areas. This is really shaking confidence in our organization's use of Oracle technology.

    Hi Mark.
    We've isolated the problem a bit more now and there is a support SR (6089662.994). At this stage we are unable to reproduce - I am testing out an export though. The problem only occurs when a certain condition has been reached. Once that happens then extraneous characters are produced in the XMLTYPE feed returned by a function. We are not at all sure about how to make this condition occur. This doesn't just happen with one SQL/XML cursor - I've seen it happen with 3 different cursors. All are located in the same function that returns an XMLTYPE.
    We are convinced the problem lies with one or more SQL/XML cursors located in the same function. Once one of these cursors malfunctions it will produce XML that is not well formed OR on occasion has content omitted but is well formed (there often seem to be extraneous characters). When the XML content is not well formed then the parsing stage (dbms_xmlparser.parseclob(myparser, xml_clob)) of XSL transformation crashes. This error then propagates to the dynamic portlet in Oracle Portal thus removing the content on the page. This happens for every execution of the cursor while the condition manifests, the only difference between calls being bind variables.
    The interesting thing is that the error if left to itself will eventually stop. The cursor seems to right itself eventually. On the last occurrence, the problem commenced at 4.30am and went for 3.5 hrs and then seemed to right itself.

  • Creating optional elements using SQL / XML functions

    Hi,
    I am struggling with some SQL / XML functionality in order to create some optional elements in a XMLType.
    I have one table with data to be generated into an XML document. The table looks like this (only the attributes related to the problem are shown):
    msg_id (pk)
    geslacht_hoofdverzekerde
    geboortedatum_hoofdverzekerde
    geslacht_medeverzekerde
    geboortedatum_medeverzekerde
    I have to create an XML document that looks like this:
    <ber:rekenparameters>
    <ber:verzekerde>
    <ber:codeRelatierol>HVZ</ber:codeRelatierol>
    <ber:geslacht>M</ber:geslacht>
    <ber:datumGeboorte>01-01-1960</ber:datumGeboorte>
    </ber:verzekerde>
    <ber:verzekerde>
    <ber:codeRelatierol>MVZ</ber:codeRelatierol>
    <ber:geslacht>V</ber:geslacht>
    <ber:datumGeboorte>01-01-1961</ber:datumGeboorte>
    </ber:verzekerde>
    </ber:rekenparameters>
    Where <ber:codeRelatierol> is hard coded: i.c. of hoofverzekerde 'HVZ' in case of medeverzekerde 'MVZ'.
    Geslacht en datumGeboorte are taken form the table.
    The element <ber:verzekerde> is obligatiry for hoofdverzekerde but optional for medeverzekerde: only in case geslacht_medeverzekerde and geboortedatum_medeverzekerde are not null this 2nd <ber:verzekerde> element has to be added.
    I created the next SQL (I skipped some stuff in order to focus on the problem):
    CREATE OR REPLACE
    VIEW dps_v_berekening_berichten
    AS
    SELECT msg_id as msg_id
    , XMLElement( "ber:berekening"
    , XMLAttributes( 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
    , 'http://www.mycompany.nl/berekenen' AS "xmlns:ber"
    , 'http://www.mycompany.nl/berekenen http://www.mycompany.nl/berekenen/berekening.xsd' AS "xsi:schemaLocation"
    , XMLElement( "ber:nummerRekenRegel"
    , XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
    , 1
    , XMLElement( "ber:rekenparameters"
    , XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
    , XMLElement( "ber:codeEvolutie" ) -- Empty
    , XMLElement( "ber:verzekerde"
    , XMLForest ( 'HVZ' AS "ber:codeRelatierol"
    , xoa.geslacht_hoofdverzekerde AS "ber:geslacht"
    , xoa.geboortedatum_hoofdverzekerde AS "ber:datumGeboorte"
    , XMLElement( "ber:verzekerde"
    , XMLForest ( 'MVZ' AS "ber:codeRelatierol"
    , xoa.geslacht_medeverzekerde AS "ber:geslacht"
    , xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
    -- Some more elements.
    ) AS bericht
    FROM DST_UP1_XML_OUTDATA xoa
    The problem is that the XMLForest always creates an <ber:verzekerde> element for medeverzekerde. I tried to create an inline view with just the "vezekerde"attributes and conditionally joining this inline view with the dst_up1_xml_outdata table. That didn't solve my problem. Because in case of a medeverzekerde available it returned two XML documenst: one that included the hoofdverzekerde and one that included the medeverzekerde. And obviously that's not what I want.
    I imagine I have to juggle with some of these SQL / XML functions although I cannot put the finger on the exact differences between some of these (XMLElement, XMLForest, XMLAgg, XMLSequence). The examples shown in de XML DB Developer's Guide don't seem to adress my problem.
    Help !

    Hi, are you talking about this part that you don't want to be there? I am not so clear about your requirements.
    XMLElement( "ber:verzekerde"
    , XMLForest ( 'MVZ' AS "ber:codeRelatierol"
    , xoa.geslacht_medeverzekerde AS "ber:geslacht"
    , xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
    If you want to control certain subelements so they don't appear, do not use xmlforest. Use xmlelement instead so it is easier to control it using case when. Mark (of Oracle, he should be here soon since OOW is over) showed me this technique and it helps tremendously, because oftentimes XDB will return an empty tag even though your consumers don't like it!
    try something like this,
    (case when xoa.geboortedatum_medeverzekerde = 'MVZ' then
    xmlelement("ber:verzekerde",
    xmlelement("What you want", colname),
    xmlelement("ber:codeRelatierol", 'MVZ'),
    (case when colname is not null or = some other value then
    xmlelement("Rest", colname))
    end)
    end),
    You may have to twig some details there. But the key is to use the case when construct to get rid of unwanted elements or empty elements. So you should only have the elements if you have a value of 'MVZ'. Hope this helps.
    Ben

  • Sql/xml -  no namespace

    Hi
    I get a "LPX-00234: namespace prefix "def" is not declared" when i run the SQL/XML code below. It works fine when i run it without the Extract() function. I am using 9.2.0.6.0.
    any help is much appreciated. i am running this directly against the database and I have no namespace set up.
    select xmlelement(name "ItemDef",
    XMLAttributes (a.oid as "OID",a.name as "df.Name"),NULL).extract('/*').getclobval()
    FROM xmlview a

    Please ignore i am a fool... declared namespace def: in code, so need to declare a def namespace in code. Used workaround
    SELECT xmlelement("links", xmlattributes('link1' AS "xmlns:def",'link2' AS "xmlns:xlink"),
    rest of code
    works now
    cheers

  • Need help in SQL (DENSE_RANK) function

    Hello All,
    I need the help in SQL.
    We have a table called status and the column are
    status_id number
    account_id number
    status_cd varchar2(10)
    created_id varchar2(10)
    created_by date
    and data is as follows
    insert into status values (1,101,'ENTER','ABC',to_date('21-JAN-2007 11:15:14','DD-MON-YYYY HH:MI:SS'));
    insert into status values (2,101,'REVIEW','DEF',to_date('21-JAN-2007 11:30:25','DD-MON-YYYY HH:MI:SS'));
    insert into status values (3,101,'APPROVE','GHI',to_date('21-JAN-2007 11:30:25','DD-MON-YYYY HH:MI:SS'));
    insert into status values (4,102,'ENTER','ABC',to_date('21-JAN-2007 11:18:14','DD-MON-YYYY HH:MI:SS'));
    insert into status values (5,102,'REVIEW','DEF',to_date('21-JAN-2007 11:33:25','DD-MON-YYYY HH:MI:SS'));
    insert into status values (6,102,'CANCEL','GHI',to_date('21-JAN-2007 11:33:25','DD-MON-YYYY HH:MI:SS'));
    insert into status values (7,103,'ENTER','ABC',to_date('21-JAN-2007 11:21:14','DD-MON-YYYY HH:MI:SS'));We have different status as follows
    1. ENTER
    2. REVIEW
    3. APPROVE
    4. CANCEL
    5. REJECT
    My requirement ..
    I need the max of created_id column for the status in ('APPROVE','CANCEL') and if there is no status in ('APPROVE','REVIEW') than it should be NULL.
    I wrote an SQL as
    select account_id,max(created_id) keep (dense_rank first order by decode(status_cd,'APPROVE',created_dt,'REVIEW',created_dt,NULL) DESC NULLS LAST,
          decode(status_cd,'APPROVE',status_id,'REVIEW',status_id,NULL) DESC NULLS LAST) last_app_rev_user
    from status
    group by account_id and gives me the output like
    ACCOUNT_ID LAST_APP_R
           101 GHI
           102 DEF
           103 ABCBut I want the Output like
    ACCOUNT_ID LAST_APP_R
           101 GHI
           102 DEF
           103 NULLAs the account 103 has no status called 'REVIEW' and 'APPROVE'
    My DB Version in 10.2.0.3.0.
    Hope I explain it properly. And if you have any other option without dense_rank still i will be happy.
    Thanks in advance for your help.
    AB
    null
    Message was edited by:
    AB

    instead of max(created_id) keep... use
    smth like max(case when status_cd in ('APPROVE','REVIEW') then created_id end) keep...

  • Error while running PL/SQL XML Parser Samples

    every time try to run the PL/SQL XML Parser Sample program i get this error no file or directory, though the file and dir exists, i have the permissions setup as in readme.txt do i need to do any chnages to init.ora,
    pls advice
    Thanks,
    SQL> exec test
    begin test; end;
    ERROR at line 1:
    ORA-20100: Error occurred while parsing: No such file or directory
    ORA-06512: at "SCOTT.XMLPARSER", line 22
    ORA-06512: at "SCOTT.XMLPARSER", line 69
    ORA-06512: at "SCOTT.TEST", line 13
    ORA-06512: at line 1

    Which examples in particular? Thanks.

  • Help in SQL Developer

    Is there any context-sensitive help in SQL Developer. I'm looking for a way to link SQL syntax with some sort of a Help function. Searching the SQL Reference pdf just doesn't cut it. For example, when I search the SQL Reference pdf for Round, I get 134 hits. I would look for a page or 2 on how to use Round, with examples, but accessible directly from SQL Developer.

    No there isn't.
    There's a rejected feature request for this at the Exchange (http://htmldb.oracle.com/pls/otn/f?p=42626:39:947182819474243::NO::P39_ID:5662), so chances are very small it ever makes it in.
    Nevertheless, you can still vote and add comments there; if there's enough weight on an item it will eventually make it for the TODO list.
    Including the doc isn't necessary, but just linking to the correct page would save a lot of time. In the case of ROUND, on pressing F1 inside the code editor or worksheet, sqldev could link directly to the SQL reference (http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions135.htm).
    If the team doesn't want to put it in, maybe someone else does. It would make a nice extension... if you feel up for it?
    K.

  • ?xml version = '1.0' encoding = 'ASCII'? pl/sql xml parser

    When ever I parse a document which has the
    <?xml version = '1.0' encoding = 'ASCII'?> tag as the first line hangs the pl/sql xml parser . If I remove the "encoding = 'ASCII'" from the file everything works fine ! What is the problem ?
    version 8.1.6 / plsql parser v2 / hpux 11x
    Here is the input file
    <?xml version = '1.0' encoding = 'ASCII'?>
    !--- This is a comment -->
    <person>
    <employee>
    <lastname>GHANTASALA</lastname>
    <firstname>SREE</firstname>
    <age>32</age>
    </employee>
    <employee>
    <lastname>TAMATAM</lastname>
    <firstname>SATISH</firstname>
    <age>30</age>
    </employee>
    </person>
    Here is my program
    declare
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    dir varchar2(100) := '/apps/oracle/drugstore';
    errfile varchar2(30) := 'err.txt' ;
    inpfile varchar2(30) := 'person.xml';
    nl xmldom.DOMNodeList;
    len number;
    n xmldom.DOMNode;
    new_node xmldom.DOMNode;
    node_name varchar2(100);
    node_value varchar2(100);
    begin
    -- new parser
    p := xmlparser.newParser;
    -- Set some characteristics
    xmlparser.setValidationMode(p, FALSE);
    xmlparser.setErrorLog(p, dir&#0124; &#0124;'/'&#0124; &#0124; errfile );
    xmlparser.setBaseDir(p, dir);
    -- parse input file
    xmlparser.parse(p, dir&#0124; &#0124;'/'&#0124; &#0124;inpfile);
    -- get document
    doc := xmlparser.getDocument(p);
    -- get all elements
    nl := xmldom.getElementsByTagName(doc, '*');
    len := xmldom.getLength(nl);
    dbms_output.put_line('Length='&#0124; &#0124;len);
    -- loop through elements
    for i in 0..len-1 loop
    n := xmldom.item(nl, i);
    node_name := xmldom.getNodeName(n);
    -- get the text node associated with the element node
    n := xmldom.getFirstChild(n);
    if xmldom.getNodeType(n) = xmldom.TEXT_NODE then
    node_value := xmldom.getNodeValue(n);
    if node_name='lastname' then
    dbms_output.put_line('The value you are looking for is -->:'&#0124; &#0124;node_value);
    if node_value = 'GHANTASALA' then
    xmldom.setNodeValue(n,'TEST2');
    end if;
    end if;
    end if;
    end loop;
    new_node := xmldom.makeNode(doc);
    xmldom.writeToFile(new_node, dir &#0124; &#0124;'/'&#0124; &#0124;'mod.xml');
    end ;
    null

    The encoding header is actually generated by
    by the following piece of code in my pl/sql program .
    new_node := xmldom.makeNode(doc);
    xmldom.writeToFile(new_node, dir &#0124; &#0124;'/'&#0124; &#0124;'mod.xml');
    Since this is a document created by the pl/sql parser, I assume there is some meaning to it !
    Also why is it hanging ? PL/sql parser should tell me that it is not a valid string !

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • How to tune the performance of Oracle SQL/XML query?

    Hi all,
    I am running Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
    SELECT XMLElement("CUSTOMER",
    XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
    (SELECT XMLAgg(XMLElement("ORDERS",
    XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
    (SELECT XMLAgg(XMLElement("LINEITEM",
    XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
    FROM LINEITEM
    WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
    FROM ORDERS
    WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
    FROM CUSTOMER ;
    Thanks very much in advance for your time,
    Jinghao Liu

    ajallen wrote:
    Why not something more like
    SELECT *
    FROM fact1 l,
    FULL OUTER JOIN fact1 d
    ON l.company = d.company
    AND l.transactiontypeid = 1
    AND d.transactiontypeid = 2;
    Because this is not an equivalent of the original query.
    drop table t1 cascade constraints purge;
    drop table t2 cascade constraints purge;
    create table t1 as select rownum t1_id from dual connect by level <= 5;
    create table t2 as select rownum+2 t2_id from dual connect by level <= 5;
    select * from (select * from t1 where t1_id > 2) t1 full outer join t2 on (t1_id = t2_id);
    select * from t1 full outer join t2 on (t1_id = t2_id and t1_id > 2);
         T1_ID      T2_ID
             3          3
             4          4
             5          5
                        6
                        7
         T1_ID      T2_ID
             1
             2
             3          3
             4          4
             5          5
                        6
                        7

  • How to perf tune Oracle SQL/XML query?

    Hi all,
    I am using Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
    SELECT XMLElement("CUSTOMER",
    XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
    (SELECT XMLAgg(XMLElement("ORDERS",
    XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
    (SELECT XMLAgg(XMLElement("LINEITEM",
    XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
    FROM LINEITEM
    WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
    FROM ORDERS
    WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
    FROM CUSTOMER ;
    Thanks very much in advance for your time,
    Jinghao Liu

    Please post this message at:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

Maybe you are looking for

  • Jsp:useBean giving error while compiling JSP's in JDeveloper

    Hello, I am having another problem with JSP's in JDeveloper 10.1.3. jsp:useBean and jsp:setProperty are all giving problems. I am not sure what I need to do to get rid of this error Thanks, Lakshmisri

  • Oracle 10g on Windows server 2008 R2 - error : Logon failed. Details: ADO

    Hello, I have installed Oracle 10g 64bit client on Windows 2008 R2 64bit server. I have installed Visual studio framework 2.0 and 3.5 on Application Server i.e. Windows 2008 R2 64bit Server. But when i run report from server, it shows following error

  • How can i format this?

    Screening, Search, and Detection    Mission Areas: Prevention, Protection     Description: Identify, discover, or locate threats and/or hazards through active and passive surveillance and search procedures. This may include the use of systematic exam

  • Can you match the workspace color from Bridge CS4 to Photoshop CS4?

    When working between Bridge and Photoshop it becomes frustrating trying to switch between my setting in Bridge which are a darker gray to that in Photoshop which is the standard ligher gray. I notice CS6 has a darker interface but I am not upgrading

  • Selection screen within tree control model

    Hello, I am very new in ABAP OO, and have to make a module program for SD to handle the status of shipment. I need to make a tree model of 3 parts that the first part has the selection screen. There is a Sap standard model: program /DSD/SL_COCKPIT wh