How to extract the node where the value of the node is the max in all of the XML document?

Hello

I have a transaction that refers to an xmltype in iRecruitment, containing multiple versions of the same node as follows:

(only for the example data)



{noformat} & lt; Transaction & gt;


& lt; data & gt;


& lt; ObjectVersionNumber & gt; 1 & lt; / object_version_number & gt;


& lt; EO & gt;


& lt; Attribute1 & gt; A & lt; / Attribute1 & gt;


& lt; Attribut2 & gt; B & lt; / attribut2 & gt;


& lt; /EO & gt;


& lt; / data & gt;


& lt; data & gt;


& lt; ObjectVersionNumber & gt; 2 & lt; / object_version_number & gt;


& lt; EO & gt;


& lt; Attribute1 & gt; A & lt; / Attribute1 & gt;


& lt; Attribut2 & gt; C & lt; / attribut2 & gt;


& lt; /EO & gt;


& lt; / data & gt;


& lt; data & gt;


& lt; ObjectVersionNumber & gt; X & lt; / object_version_number & gt;


& lt; EO & gt;


& lt; Attribute1 & gt;? & lt; / Attribute1 & gt;


& lt; Attribut2 & gt;? & lt; / attribut2 & gt;


& lt; /EO & gt;


& lt; / data & gt;


& lt; / Transaction & gt; {noformat}

I can extract a value for FULL-TIME 1 or 2, is not a problem.
However, how can I go on the selection of a value of an attribute below FULL-TIME X, where X is the maximum value of FULL-TIME in any node in the XML document?

I tried to the last node corresponding to my way, but it is not always the case that the FULL-TIME max will correspond to this scenario.

Any help would be greatly appreciated!

Thank you very much, Pete

Published by: Pete Mahon on February 24, 2009 12:11

Here's a way

SQL> set long 100000
SQL> with XML as (
  2  select XMLTYPE(
  3  '
  4  
  5     
  6             1
  7             
  8                     A
  9                     B
 10             
 11     
 12     
 13             2
 14             
 15                     A
 16                     C
 17             
 18     
 19     
 20             3
 21             
 22                     ?
 23                     ?
 24             
 25     
 26  ') OBJECT_VALUE
 27    from dual
 28  )
 29  select DATA, OVN
 30    from XML,
 31         XMLTable
 32         (
 33           '/Transaction/data'
 34           passing OBJECT_VALUE
 35           columns
 36           DATA XMLType path '.',
 37           OVN  number  path 'ObjectVersionNumber'
 38         )
 39   where OVN = ( select MAX(OVN)
 40                   from XML,
 41                        XMLTable
 42                        (
 43                          '/Transaction/data'
 44                          passing OBJECT_VALUE
 45                          columns
 46                          OVN  number  path 'ObjectVersionNumber'
 47                        )
 48               )
 49
SQL> /

DATA
--------------------------------------------------------------------------------
       OVN
----------
3?
?
         3

SQL>

Tags: Database

Similar Questions

  • How to extract the XML with namespace?

    Hi all

    Here's the XML I:

    <? XML version = "1.0" encoding = "UTF-8"? >
    -< transaction xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns = "http://schemas.test.com/Support/Services/test1/2012" xsi: schemaLocation = "http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd" >
    -< application >
    < > 10 Sam < / Sam >
    < > 32 Actid < / Actid >
    < Pax > 3 < / Pax >
    < > 10 - DEC - 2012 Flt < / Flt >
    < user name > WebUserNameTest < / name >
    < / request >
    < application >
    < Sam > 1 < / Sam >
    < Actid > 3 < / Actid >
    < > 2 Pax < / Pax >
    < Flt > 2012 - dec - 12 < / Flt >
    < user name > WebUserNameTest < / name >
    < / request >
    < / transaction >

    I need to extract the item values:

    The code below will help me when I have no namespace, what needs to be done in order to work with the value of the element namespace and etract

    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Sam / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .memid: =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();


    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Actid / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .actid: =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();

    v_string_xml: =.
    ' / / Query [']
    || To_char (counter_xml)
    || '] / Pax / text () ';
    v_ssp_table (v_ssp_table..) Pax COUNT): =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();

    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Flt / text () ';
    v_ssp_table (v_ssp_table..) Flt COUNT): =.
    p_xml_in. EXTRACT (v_string_xml) .getstringval ();

    v_string_xml: =.
    ' / / Query [']
    || To_char (counter_xml)
    || '] / Username / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .username: =.
    p_xml_in. EXTRACT (v_string_xml) .getstringval ();
    declare
      v_xml xmltype := xmltype( '
    
    
    10
    32
    3
    2012-DEC-10
    WebUserNameTest
    
    
    1
    3
    2
    2012-DEC-12
    WebUserNameTest
    
    ' );
    begin
      for r_xml in ( select *
                     from xmltable( xmlnamespaces( default 'http://schemas.test.com/Support/Services/test1/2012' )
                                   , '/Transaction/Request'
                                   passing v_xml
                                     columns memid number path 'Memid'
                                           , actid number path 'Actid'
                                           , pax number path 'Pax'
                                           , flt varchar2(100) path 'Flt'
                                           , username varchar2(100) path 'Username'
                                  )
                   )
      loop
        dbms_output.put_line( r_xml.memid );
        dbms_output.put_line( r_xml.actid );
        dbms_output.put_line( r_xml.pax );
        dbms_output.put_line( r_xml.flt );
        dbms_output.put_line( r_xml.username );
      end loop;
    end;
    
  • How to extract the values of XMLTYPE column,

    SQL > create table temporary global xmtype_tab (xmlfile xmltype);

    SQL > select * from all_directories;

    SYS RESTOREDIR/home / / dbimptask /.

    insert into xmtype_tab values (xmltype (dbms_xslprocessor.read2clob ('RESTOREDIR ','LAS_SETUP.xml ')));

    1 line of creation.

    SQL > select * from xmtype_tab;

    XMLFILE
    --------------------------------------------------------------------------------
    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >


    How to extract the values inside each tag?


    XML file has the following data...


    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >
    < > 9600 BAUD_RATE < / BAUD_RATE >
    < ACK_TIMEOUT > 1 < / ACK_TIMEOUT >
    < TUBE_TRAVEL_LIMIT > 4 < / TUBE_TRAVEL_LIMIT >
    < SEND_SID_TIMEOUT > 1 < / SEND_SID_TIMEOUT >
    < INDEX_Q_TIMEOUT > 2 < / INDEX_Q_TIMEOUT >
    < HW_HANDSHAKING > 1 < / HW_HANDSHAKING >
    < / ROW >
    < / LINES > ';

    I use the Oracle 10.2.0.3 version...

    Why does this work?

    You are missing the tag of the ROWSET:

    select extractvalue (xmlfile, '/ROWSET/ROW/BAUD_RATE') baud_rate
      from xmltype_tab
     where existsnode (xmlfile, '/ROWSET/ROW/BAUD_RATE') = 1;
    
  • Need urgent help! In my Vision Application, how to extract the parameters of the geometric model specified curve was generated by the template editor OR?

    I have an application of machine vision, in which the geometric pattern match technique was used to find the target in the images of type variant.

    as we know, we do a geometric model by model OR editor in the editor we can adjust the parameters of the curve specified settings to get the desired curves and we derive the custom box to ignore during the match. then we save the use of the same model in our application of vision.

    Now my question is coming. When I program my request for the geometric game. I have specified the parameters of the curve for the entrance of the IMAQ Advanced Setup learn ringtone 2, of course, I have to adjust this identical to the model, but I don't know how we extract the geometric model. I tried all the methods, for example, I can read data custom, IMAQ get characteristics of the geometric model(it's just for the basic functionality? so is there even a VI based edge?), even at anasys PNG file formats! But I can't read the info of the geometric model by myself!

    It is also illogical to adjust the CURVE SETTINGS manually again for the " IMAQ Advanced Setup Learn Pattern 2" after that I already have in the template editor OR!

    Hello

    Why do you need to specify the curve settings once again, if you have already built a model using the template editor? You don't need to use "IMAQ Advanced Setup learn geometric model 2 VI" to find games (see the attached example).

    You can wire the 'curve settings' control to 'IMAQ configuration geometrical game model 2 VI', but the values are not used if wire you a Boolean true to the node "use learning curve settings" (it's like that by default). To prove it, I enclose a small program with pre-created model (using the template editor) for a geometrical alignment. The model and the test of three images are also included.

    Try changing the settings of the curve with the 'use know curve settings' enabled, and you will see the corresponding score remains the same. Disable the Boolean control, then try to change the curve settings.

    Also take a look at the detailed help for "IMAQ configuration geometrical game model 2 VI", specifically the "learning curve parameters of use."

    I hope this helps.

    Best regards

    K

  • How to extract the signal from the waveform of my power level designated?

    Hi all

    How can I extract the signal of the waveform accroding to the power level? I read the Trigger & Gate .vi, but this vi retrieves the signal duration. I want to extract the signal depending on the power level.

    As shown in the following figures, the signal I want to deal with is between 130000 to 140000, if I Zoom, I can see the useful signal is between 135400 to 138200. The question is how to extract the signal in the area?

    I tried the sub_NoiseEst_And_Chop_Shell.vi in the example of Packet_based_link also, but this Subvi seems to be a bit slow. Can someone give me the best advice? Thanks in advance!

    I'm working on something similar, but have not had time to fully develop.

    My idea was to use an envelope detector (low pass filter) and then use a detection of energy VI on the envelope.

    Here is where I left

  • I downloaded a free trial of Adobe Creative cloud and dreamweaver CC. I am not able to download a .psd to see how to extract the HTML and CSS.

    I downloaded a free trial of Adobe Creative cloud and dreamweaver CC. I am not able to download a .psd to see how to extract the HTML and CSS.

    Download button is disabled. What is the case for a free trial?

    Hey girijamg,

    I asked that you try to open a page because snippet Panel will be disabled until there is a html page is open in DW.

    Excerpt from Panel will be ready for the job that after any html page is open in DW.

    Hope it makes sense.

    Lalita

  • How to import the Word document into inDesign?

    I tried to import the document into inDesign (CS6) but the import has failed. 35 pages of DOCX ended up in a block of text on the first page. Other pages are blank.

    How to adjust the import document and get a block of text per page without overflow of text?

    2016.01.05_16h52m59s_002.jpg

    Hold the SHIFT key when you click on install. It will be "automatic formatting" to all pages and create new ones if necessary.

  • Merge the XML document in a table

    Hello
    I want to merge some of the values of an xml document in a table "Project_Table".

    CREATE TABLE Project_Table
    (
    TASK_ID NUMBER (15),
    TASK_NAME VARCHAR2 (100 BYTE),
    START_DATE DATE,
    )

    I am using the following procedure, that I adapted from another post. It inserts null values, I think because I'm not showing the nodes correctly.

    DECLARE
    BFILE v_bfile: = BFILENAME ("'DTEMP","test.xml");
    v_clob CLOB.
    BEGIN
    -Create directory DTEMP as "C:\TEMP";
    -grant read the < schema > DTEMP directory;

    DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
    DBMS_LOB. OPEN (v_bfile, DBMS_LOB.lob_readonly);
    DBMS_LOB. LoadFromFile (v_clob, v_bfile, DBMS_LOB.lobmaxsize);
    Dbms_output.put_line (v_clob);
    MERGE IN project_table t
    USING (SELECT TO_NUMBER (EXTRACTVALUE (VALUE (x), ' / task ')) task_id,)
    To_date (EXTRACTVALUE (value (x), "/ start"), 'DD-MM-YYYY') start_date,
    EXTRACTVALUE (value (x), "/ name") TaskName
    (SELECT XMLTYPE (v_clob) XML
    THE DOUBLE).
    TABLE (XMLSEQUENCE (EXTRACT (xml, ' / project'))) x) r
    WE (t.task_id = r.task_id)
    WHEN MATCHED THEN
    UPDATE
    SET t.start_date = r.start_date, t.task_name = r.task_name
    WHEN NOT MATCHED THEN
    INSERT (task_id, start_date, taskname)
    VALUES (r.task_id, r.start_date, r.task_name);
    COMMIT;
    END;

    This is the document of test.xml.

    <? XML version = "1.0" encoding = "UTF-8"? >
    -name of the project 'ProjectName' company 'Company' webLink = = = "" view-date = '2009-12-14"see-index '0' = gantt-Divider-location = '300' resource-divider-card ="300"version ="2.0">"
    < description / >
    < zoom-view state = "default: 8" / >
    -<!
    ->
    -< calendars >
    -day-types >
    < day-type id = '0' / >
    < day-type id = "1" / >
    -< Calendar id = "1" name = "default" >
    < Sun weeks default = '0' LUN '0' = TEU = '0' kills = '0' game = '0' Fri '0' = Saturday = '0' / >
    < overloaded-day-types / >
    < days / >
    < / calendar >
    < / day-types >
    < / calendars >
    -task color = "#8cb6ce" >
    -< taskproperties >
    < taskproperty id = "tpd0" name = 'type' type = 'default' valuetype = "icon" / >
    < taskproperty id = "TDP1" name = 'priority' type = 'default' valuetype = "icon" / >
    < taskproperty id = "tpd2" name = 'info' type = 'default' valuetype = "icon" / >
    < taskproperty id = "tpd3" name = "name" type = 'default' valuetype = "text" / >
    < taskproperty id = "tpd4" name = "begindate" type = 'default' valuetype = "date" / >
    < taskproperty id = "tpd5" name = "enddate" type = 'default' valuetype = "date" / >
    < taskproperty id = "tpd6" name = "Duration" type = 'default' valuetype = "int" / >
    < taskproperty id = "tpd7" name = "completion" type = 'default' valuetype = "int" / >
    < taskproperty id = "tpd8" name = "Coordinator" type = 'default' valuetype = "text" / >
    < taskproperty id = "tpd9" name = "predecessorsr" type = "default" valuetype = "text" / >
    < / taskproperties >
    < job id = '0' name = 'TaskA"color =" #0099cc "form = meeting"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"="false"start ="2010-01-28"duration ="1"complete ="0"priority ="1"expand ="true"/ >
    < task id = "1" name = "TaskB" color = "#ff0000" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-01-28" duration = "1" complete = "100" priority = "1" expand = "true" / >
    < job id = "2" name = 'Day' color = "#ff9933" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "19" complete = "0" priority = "1" expand = "true" / >
    < job id = "3" name = "TaskD" color = "#ff0000" form = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" meeting = "false" start = "2010-02-01" duration = "32" full = "100" priority = "1" expand = "true" / >
    < job id = "4" name = "TaskE" color = "#66ff99" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "67" complete = "0" priority = "1" expand = "true" / >
    < job id = "5" name = "TaskF" color = "#66ff99" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "46" complete = "10" priority = "1" expand = "true" / >
    < job id = "6" name = "TaskG" color = "#00cccc" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-03-15" duration = "30" complete = "0" priority = "1" expand = "true" / >
    < job id = "7" name = "TaskH" color = "#00cccc" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-03-15" duration = "103" full '1' = '1' priority = expand = "true" / >
    < job id = "8" name = "TaskI" color = "#0000ff" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = '2010-04-26' length = "11" complete = "0" priority = "1" expand = "true" / >
    < job id = '9' name = 'TaskJ"color =" #0000ff "form = meeting"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"="false"start = '2010-04-26' length ="11"complete ="0"priority ="1"expand ="true"/ >
    < job id = "10" name = "TaskK" color = "#000000" meeting = 'false' start time = "2010-07-12" = "65" full = "0" priority = "1" expand = "true" / >
    < / tasks >
    < resources / >
    < allowances / >
    < holiday / >
    -< taskdisplaycolumns >
    < displaycolumn property id = "tpd3" order = "0" width = "75" / >
    < displaycolumn property id = "tpd4" order = "1" width = "75" / >
    < displaycolumn property id = "tpd5" order = "2" width = "75" / >
    < displaycolumn property id = "tpd7" order = "3" width = "75" / >
    < / taskdisplaycolumns >
    < Previous / >
    < roles roles-name = "Default" / >
    < / project >

    Any ideas how to change the procedure, in order to merge the data in the xml document in the table?

    Thank you

    Hello

    Here's what you need in your USING clause:

    SELECT to_number(extractvalue(column_value, 'task/@id'))                as task_id,
           to_date(extractvalue(column_value, 'task/@start'), 'YYYY-MM-DD') as start_date,
           extractvalue(column_value, 'task/@name')                         as task_name
    FROM TABLE(
      XMLSEQUENCE(
        EXTRACT(xmltype(v_clob), '//task')
      )
    )
    

    Since you want nodes "task" request, just extract them directly. In addition, 'id', 'start', 'name' is attributes, you must access them with an '@'.

    You can also take a look at function XMLTABLE (which tends to replace construction TABLE (XMLSEQUENCE (...))):

    SELECT *
    FROM XMLTABLE(
     '//task'
     passing xmltype(v_clob)
     columns task_id    number(15)    path '/task/@id',
             start_date date          path '/task/@start',
             task_name  varchar2(100) path '/task/@name'
    )
    

    Edit: the XMLType constructor overload taking a BFILE type as an argument, so you can simplify the code a bit more:

    DECLARE
    
     v_xml XMLTYPE := XMLTYPE( BFILENAME('DTEMP', 'test.xml'), nls_charset_id('AL32UTF8') );
    
    BEGIN
    
    MERGE INTO project_table t
    USING (
      SELECT *
      FROM XMLTABLE(
       '//task'
       passing v_xml
       columns task_id    number(15)    path '/task/@id',
               start_date date          path '/task/@start',
               task_name  varchar2(100) path '/task/@name'
      )
    ) r
    ON (t.task_id = r.task_id)
    WHEN MATCHED THEN ...
    WHEN NOT MATCHED THEN ...
    ;
    
    ...
    
    END;
    

    HTH

    Published by: odie_63 on March 18, 2010 12:13

    Published by: odie_63 on March 18, 2010 12:15

  • Change the content of the xml document as data selected with SQLX functions

    Hi all
    I have seen several examples of database xml documents using SQLX functions but they seem to be simple queries, which we reproduce the same forest of xml in all elements. What I'm trying to do is to create something like the following:


    < billing xmls = "http://blurb.com" >
    < header >
    < timestamp > 2008-12-11 13:28:46 < / timestamp >
    < source > ORCL < / source >
    < / header >
    < transaction and billing-answers >
    < invoice-transaction-response >
    < invoice-transaction-id > 36866320 < / billing-transaction-id >
    ORDER of < invoice-transaction-type > < / billing-transaction-type >
    <-group-id of transaction > 092220082100 < / transaction-group-id >
    < ok >
    < charged to date > 2008-09-22T 10: 20:43 - 05:00 < / beak-date >
    < /OK. >
    < / billing-transaction-response >
    < invoice-transaction-response >
    < invoice-transaction-id > 37617490 < / billing-transaction-id >
    ORDER of < invoice-transaction-type > < / billing-transaction-type >
    <-group-id of transaction > 112020082100 < / transaction-group-id >
    < error >
    reasons <>
    < reason >
    < text > impossible to derive information of customer SHIP_TO < / text >
    < / reason >
    < / reasons >
    < / error >
    < / billing-transaction-response >
    < / billing-transaction-answers >
    < / billing >


    I can see how to generate the individual components of the xml document, but I don't know how to put this together in a single select statement:


    SQL > SELECT XMLElement ("billing", XMLAttributes (http://blurb.com LIKE "xmls")
    2, XMLElement ("header"
    3, XMLElement ("timestamp", TO_CHAR (SYSDATE, ' YYYY-MM-DD HH24:MI:SS'))))
    4, XMLElement ("source", "ORCL'"))).extract('/*') xml
    5 FROM DUAL;

    XML
    ----------------------------------------------------------------------------------------
    < billing xmls = "http://blurb.com" >
    < header >
    < timestamp > 2008-12-11 13:28:46 < / timestamp >
    < source > ORCL < / source >
    < / header >
    < / billing >


    SQL > SELECT XMLElement ("billing transaction-answers"
    2, XMLAgg (XMLElement ("billing-transaction-reply"
    3, XMLElement ("billing transaction id", billing_transaction_id)
    4, XMLElement ("billing-transaction-type", billing_transaction_type)
    5, XMLElement ("transaction-group-id", transaction_group_id)
    6, XMLElement ("ok"
    7, XMLElement ("beak-date", billed_date))).extract('/*') xml
    8 FROM table_a
    9 status WHERE! = 'E';

    XML
    ----------------------------------------------------------------------------------------------------
    < transaction and billing-answers >
    < invoice-transaction-response >
    < invoice-transaction-id > 36866320 < / billing-transaction-id >
    ORDER of < invoice-transaction-type > < / billing-transaction-type >
    <-group-id of transaction > 092220082100 < / transaction-group-id >
    < ok >
    < charged to date > 2008-09-22T 10: 20:43 - 05:00 < / beak-date >
    < /OK. >
    < / billing-transaction-response >
    < / billing-transaction-answers >



    MDACFS@CORPD23 > SELECT XMLElement ("billing transaction-answers"
    2, XMLAgg (XMLElement ("billing-transaction-reply"
    3, XMLElement ("billing transaction id", billing_transaction_id)
    4, XMLElement ("billing-transaction-type", billing_transaction_type)
    5, XMLElement ("transaction-group-id", transaction_group_id)
    6, XMLElement ("error"
    7, XMLElement ("patterns"
    8, XMLElement ("reason"
    9, XMLElement ("text", error_message))).extract('/*') xml
    10 FROM table_a
    * 11 situation WHERE = 'E '; *

    XML
    -------------------------------------------------------------------------------------
    < transaction and billing-answers >
    < invoice-transaction-response >
    < invoice-transaction-id > 37617490 < / billing-transaction-id >
    ORDER of < invoice-transaction-type > < / billing-transaction-type >
    <-group-id of transaction > 112020082100 < / transaction-group-id >
    < error >
    reasons <>
    < reason >
    < text > impossible to derive information of customer SHIP_TO < / text >
    < / reason >
    < / reasons >
    < / error >
    < / billing-transaction-response >
    < / billing-transaction-answers >

    This is my first attempt to generate xml from the database if it is not a correct approach then please notify. Any help much appreciated.

    See you soon,.
    Paul.

    Given you already wrote each song as a separate statement which refers to what you want, you already have the concept and just need to merge the three queries SQL in one alone. Here is an example of the fusion of your first two SQL set statements.

    SELECT XMLElement("billing", XMLAttributes('http://blurb.com' AS "xmls")
            ,XMLElement("header"
              ,XMLElement("timestamp", TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS'))
              ,XMLElement("source", 'ORCL')
             ),
             (SELECT XMLElement("billing-transaction-replies"
                      ,XMLAgg(XMLElement("billing-transaction-reply"
                       ,XMLElement("billing-transaction-id", rownum))))
               FROM dual
               CONNECT BY level <= 5
             )) rslt
    FROM DUAL;
    
    returns
    
    
         
    2008-12-12 09:21:39 ORCL
    1 2 3 4 5
  • Display the error when the xml document is not valid against the schema

    Hello

    I'm using isChemaValid() in a way that, to determine if the xml document is valid against the xml schema.

    This function returns only 0 or 1, and I want to display the error and the line number if the xml is not valid.

    How can I achieve this?

    Thanks in advance,

    Elad

    Use the XMLType schemaValidate() method. It will throw an exception whose message contains the validation error.

    Get a number of 'line' is not sensible as XML is concerned.

  • How to extract the values of column aliases based on different column values?

    Hello gurus,

    I have a table with the following struture-
    "drop table T;
    create table T(Name, Symbol, Amount,dep) as select
    'Anderia', 'AA', 1050000,'HR' from dual union all select
    'Michael', 'ML',150000,'Sales' from DUAL union all select
    'Bill', 'BL', 1050000,'Finance' from dual union all select
    'Nancy', 'NY', 4000,'HR' from DUAL union all select
    'Anderia', 'AA',3000,'HR' from dual union all select
    'Michael', 'ML',1050000,'Sales' from DUAL union all select
    'Bill', 'BL', 1200000,'Finance' from DUAL union all select
    'Anderia', 'AA', 1200000,'HR' from DUAL union all select
    'Vish', 'VH', 1200000,'Marketing' from DUAL;"
    And try to find the values of the column as
    Name, symbol, dep, amount, % Total, Total $Cumm, rank but some additional as-columns

    Amount HR, % HRTotal, $HR Cumm Total,
    Finance amount, FinanceTotal %, $Finance Cumm Total
    Sales amount, a percentage of Total sales, $Sales Cumm Total.
    Amount marketing, MarketingTotal %, $Marketing Cumm Total

    then I use the following query to retrieve the name, the symbol, the dep, amount, % Total, Total $Cumm, rank columns.
    select name
         , decode(grouping(symbol), 0, symbol, 'Total') symbol
         , dep
         , sum(amount) amount
         , sum(per_total) "% Total"
         , decode(grouping(symbol), 0, max(Cum_per_total), null) "% Cumm Total"
         , decode(grouping(symbol), 0, max(rank), null) rank
      from (
              select name
                   , symbol
                , dep
                   , amount
                   , per_total 
                   , sum(per_total) over(order by rk) cum_per_total
                   , rank
                   , rk
                from (     
                        select name
                             , symbol
                    , dep
                             , sum(amount) amount
                             , round((sum(amount)/max(total_amount)) * 100,2) per_total
                             , dense_rank () over (order by sum(amount) desc) as rank
                             , row_number() over(order by sum(amount) desc) as rk
                          from (
                                 select name
                                      , symbol
                                      , amount
                          , dep
                                      , sum(amount) over() total_amount 
                                      , sum(amount) over () 
                                   from t
                               )
                         group 
                            by name, symbol, dep
                    )
            )
      group         
         by grouping sets((name, symbol, dep), ())
      order by rank, max(rk) nulls last
    But I want to extract the following columns so... How can I do?

    Amount HR, % HRTotal, $HR Cumm Total,
    Finance amount, FinanceTotal %, $Finance Cumm Total
    Sales amount, a percentage of Total sales, $Sales Cumm Total.
    Amount marketing, MarketingTotal %, $Marketing Cumm Total


    as I want that all records, then will the dep..do-specific I need to use the case here?
    Thanks for all your time and effort in advance

    If I understand your needs, you need pivot: SQL and PL/SQL FAQ

  • How to extract the second sysdate value using the EXTRACT function

    Hello

    I want to extract the second sysdate value using the EXTRACT function.
    When I run the following query I get an error;

    SELECT extract (second OF SYSDATE) FROM dual;

    ORA-30076: field of invalid extract for the source of the extract.

    When I do to extract the month I get the correct result.

    Is there some necessary formatting by specifying the sysdate (or any other date value) in the query. ?


    Thank you.

    You can extract only the year/month / day, day

    SQL> Select extract(year from sysdate) from dual;
    
    EXTRACT(YEARFROMSYSDATE)
    ------------------------
                        2008
    
    SQL> Select extract(day from sysdate) from dual;
    
    EXTRACT(DAYFROMSYSDATE)
    -----------------------
                         20
    
    SQL> Select extract(month from sysdate) from dual;
    
    EXTRACT(MONTHFROMSYSDATE)
    -------------------------
                           11
    
    IF you enter Minute or Seconds
    
    SQL>  Select extract(minute from sysdate) from dual;
     Select extract(minute from sysdate) from dual
                                *
    ERROR at line 1:
    ORA-30076: invalid extract field for extract source
    but with timestamp you can get the seconds
    
    SQL> select EXTRACT(second FROM current_timestamp) from dual;
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  39.473
    
    SQL> select EXTRACT(second FROM current_timestamp) from dual;
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  57.474
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  59.787
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                    .412
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                     .99
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   1.458
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   1.896
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   2.334
    

    Edited by: Viswarayar Maran on November 20, 2008 14:30

  • How to extract the values of the other tables in the process upon request

    Hi all
    In Oracle Apex 4.1.
    The Leave_transaction Table contains the following fields,
    1.Leave_id
    2.Emp_name
    3.From_date
    4.To_date
    5.Remaining_days
    The Emp_Master Table contains the following columns
    1.Emp_id
    2.Emp_Name
    3.Remaining_days
    Holiday_master table contains a list of the dates of the holidays as 'From_Date '.

    I have the form based on the Leave_Transaction Table,
    I created the process,
    "Sur-Soumettre after calculations and validations of."
    and posted the following PLSQL code,
    declare
    days number(3);
    ex_days emp_master.remaining_days%type;
    new_rem_days emp_master.remaining_days%type;
    begin
    select count(*) into days from (select dt
    from(
        select to_date(:p1_from_date, 'DD-Mon-YYYY') + rownum -1 dt 
            from dual
    connect by level <= to_date(:p1_to_date, 'DD-Mon-YYYY') - to_date(:p1_from_date, 'DD-Mon-YYYY') + 1)
    where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holiday_start from holiday_master)) dual ;
    
     select remaining_days into ex_days from emp_master where upper(emp_name) = upper(:APP_USER);
    new_rem_days := ex_days - days;
    
      update emp_master set
        remaining_days = new_rem_days
        where upper(emp_name) = upper(:APP_USER);
    update leave_transaction set
        remaining_days = new_rem_days
        where upper(emp_name) = upper(:APP_USER) and
         leave_id=(select max(leave_id) from leave_transaction);
    
    end;
    If the date is between from_date and To_date comes Saturday and Sunday or if any Date exists in the table of Hpliday_master he will exclude and return the count (*) rest of dates.
    For example,.

    If the From_date is 04-may-2012'
    and To_date is 08-may-2012,

    Here the dates 5 May and 6 may are "Saturday" and "Sunday".

    and if any date between From_date and To_date is exist in the Table Holiday_Master
    That is to say that here it is 07-may-2012,

    Then the remaining dates are (excluding sat, Sunday and dates in holiday_table).

    04-may-2012,
    08-may-2012.

    the count (*) is 2.

    I use the code above but it return 5.
    I think that this
     
    ...where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holiday_start from holiday_master))
    code does not work.
    Can someone help me solve my problem.

    Edited by: Gurujothi may 3, 2012 23:59
    set serveroutput on;
    declare
    v_sql varchar2(100);
    begin
            v_sql := 'ALTER SESSION SET NLS_LANGUAGE= ''GERMAN''';
            execute immediate  v_sql;
            dbms_output.put_line(v_sql);
            for c in
                        (
                        select to_char(sysdate + level ,'fmday') day_
                        from dual
                        where to_char(sysdate + level,'fmday') not in ('sunday','saturday')  connect by level < 8
                        ) loop
                        v_sql := c.day_;
                         dbms_output.put_line(v_sql);
                        end loop;
    
            v_sql := 'ALTER SESSION SET NLS_LANGUAGE= ''AMERICAN''';
            execute immediate  v_sql;
            dbms_output.put_line(v_sql);
            for c in
                        (
                        select to_char(sysdate + level ,'fmday') day_
                        from dual
                        where to_char(sysdate + level,'fmday') not in ('sunday','saturday')  connect by level < 8
                        ) loop
                        v_sql := c.day_;
                         dbms_output.put_line(v_sql);
                        end loop;
    end;
    /
    
    ALTER SESSION SET NLS_LANGUAGE= 'GERMAN'
    samstag
    sonntag
    montag
    dienstag
    mittwoch
    donnerstag
    freitag
    ALTER SESSION SET NLS_LANGUAGE= 'AMERICAN'
    monday
    tuesday
    wednesday
    thursday
    friday
    PL/SQL procedure successfully completed.
    
  • How to extract the images filled in numbers?

    Hello community,

    I have prepared a file number for one of my clients with basic information and photos of products. I now need to export to Excel, but it does not keep the images which were filled in the cells of the numbers.

    Is there a way to extract the images of cells of numbers? I took these pictures on the internet directly, so I have stored them in a special place. I think, however, that they could be stored somewhere on my mac but cannot find them.

    I have over 300 images inserted in 300 cells, so I'll try to avoid to find their return and save them properly.

    Thanks for your help!

    I've tried in the past to extract numbers background images but never succeeded.

    I know that when you click on a cell and command + c to copy the content to the system Clipboard background images is included, because you can also click and command + v to paste the images follow the dough.

    But how the numbers stores the image to the system Clipboard when you copy and paste is not, as far as I know, documented.  It is so difficult to "get to work."

    If you are handy with AppleScript, you can try + command + c to copy and then run this script.

    the Clipboard as record

    This will list the contents of the Clipboard.  Give more information on how the image is stored in this folder could make it possible to shape a script to extract the images.

    But that is as far as I'm away.

    The folks at Mac OS technology discussions might know how.

    SG

  • How to extract the ISO image to CD?

    I would like to know any tool in Windows XP to extract the ISO image to CD.

    Thanks in advance for your suggestions

    I would like to know any tool in Windows XP to extract the ISO image to CD.

    I think you're probably asking to write the contents of an ISO image to a CD. If this is the case, you will need to use a burning CD/DVD software to do the job. Windows XP has no native support for burning ISO images.

    Nero, Roxio - these programs are well known actors in this area, but they come with a price tag. If you have these programs already installed in the computer, you can simply search the help content within these software to find out how to burn ISO images to use.

    But, if you don't have this software, you can download ISO free burning programs to do the job. Search online for free ISO burning software and you'll get a ton of these programs.

    This is a good program to burn ISO images:
    http://www.ImgBurn.com/

    I hope that helps!

Maybe you are looking for

  • Finder in OSX 10.11.6

    After the upgrade the MacBook to the version of Mac OS X 10.11.6 closed my Finder window, and you can't open documents, even when I tell them the opposite effect

  • HP Photosmart 7520 e‑All‑in‑On: cannot install Photosmart 7520

    I had problems with my wireless printer so I removed from my list of device and tried to re-intall.  I did it in the past and it seemed to solve the problem.  This time, my computer is unable to find the printer at all.  I tried to reset my router, m

  • Why can't I change my address (ID) to my windows live email?

    After that I typed in the new email address, that's what I got: You have already renamed this account. Please try again later. But, I do not rename the account long enough.  And, I do not change the e-mail address for a long time. Help, please.  Than

  • No visible computers in the network

    I use a desktop computer on (in English) windows XP Edition family and two laptop computers on Windows Vista. All are connected in a home network (with the same name of working group). Now I can 'see' my office in the network from my laptop, but I ca

  • When I start my computer it comes up with a ' windows no disk "message

    Exception processing message c0000013 parameters 75b6bf7c 4 75b6bf7c Another Exception processing message c0000013 4 75b6bf7c parameters75b6bf7c he continues to repeat itself, and another larger message appears... There is no disk in the drive. Pleas