How to get the Max of elements of type datetime value

Hi all
I wanted to get the last value timestamp (DateTime data type) of the node list. I have the following xml. In this xml file, I want to get the modifydate element that has the last time stamp via xquery/xpath, it should return me following result 2011-09-29 T 17: 21:17 + 10:00

< CustomerList >
< CustomerDetails >
< Name > Test 1 < / name >
assets of < status > < / status >
< modifyDate > 2011-08-20T 17: 21:17 + 10:00 < / modifyDate >
< / CustomerDetails >

< CustomerDetails >
< Name > Test 2 < / name >
Cancel < status > < / status >
< modifyDate > 2011-08-29T 17: 21:17 + 10:00 < / modifyDate >
< / CustomerDetails >

< CustomerDetails >
< Name > Test 3 < / name >
assets of < status > < / status >
< modifyDate > 2011-09-29T 17: 21:17 + 10:00 < / modifyDate >
< / CustomerDetails >
< / CustomerList >


I tried to use the
CustomerList/CustomerDetails/modifyDate [not (. < =... / the above - sibling:CustomerList/CustomerDetails modifyDate) and not (. < =... / following - sibling:CustomerList/CustomerDetails modifyDate)]
But it does not work on the datetime data type.
Any help in this regard is highly appreciated.

Concerning

Published by: user6736659 on Sep 5, 2011 06:15

Hello

The following XQuery query should give you what you want:

max(
 for $i in /CustomerList/CustomerDetails/modifyDate
 return xs:dateTime($i)
)

For example, by using Oracle SQL:

SQL> var xmldoc varchar2(4000)
SQL> begin
  2   :xmldoc := '
  3  
  4   Test 1
  5  active
  6  2011-08-20T17:21:17+10:00
  7  
  8
  9  
 10   Test 2
 11  cancel
 12  2011-08-29T17:21:17+10:00
 13  
 14
 15  
 16   Test 3
 17  active
 18  2011-09-29T17:21:17+10:00
 19  
 20  ';
 21  end;
 22  /

PL/SQL procedure successfully completed

SQL> select xmlquery('max(
  2   for $i in /CustomerList/CustomerDetails/modifyDate
  3   return xs:dateTime($i)
  4  )'
  5  passing xmltype(:xmldoc)
  6  returning content
  7  )
  8  from dual
  9  ;

XMLQUERY('MAX(FOR$IIN/CUSTOMER
--------------------------------------------------------------------------------
 2011-09-29T17:21:17.000000+10:00
 

Tags: Oracle Development

Similar Questions

  • How to get the desired TableCell element of TableView?

    Hello
    I implement an editable table view.
    I put the cell factory to generate editable cells in each column. Double click on any cell, the 'startEdit()' of my Tablecell method is called and a textfield appears.
    My current role is on the text box TAB, the next cell in the column of the row must be in editable form. (that is to say I have to call the method startEdit() of the next collection of the TableCell element).

    But I don't get how to get the element of the next column TableCell object.

    Can someone help me get this behavior. ? If there is also another way to get this feature please let me know. ?

    Here is the code I am trying to get with on the text field.
    textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
                @Override public void handle(KeyEvent t) {
                    if (t.getCode() == KeyCode.TAB){
                         System.out.println("Focus on next column....");
                         //getTableRow().getAlignment();
                         //getIndex();
                         //getTableView().getItems().get(getTableRow().getIndex());
                         //TableCell cell = (TableCell)getTableRow().getChildrenUnmodifiable().get(1);
                         
                    }
                }
            });
    Thanks in advance.
    SAI

    Maybe, I'm not entirely understand your question, but could you not call tableView.edit (line, column) of your article and have this as the StartEdit method call for you?

    -Jonathan

  • How to get the Max value in Essbase

    Hello

    I have problem to get the max value of 3 years in Essbase.
    How can I get the max value of Dec 2009, Dec 2010, Dec 2011.
    Suppose the value of Dec 2009 = 1000, dec 2010 = 1500 and Dec 2011 = 2000
    I want to get the max value of these three value, how can I do this in the Essbase calculation Script.
    Any idea?


    Thank you.

    Kind regards

    Joni

    You did not specify if year and period are there separate dimensions, in any case as always a number of different possbilities and I don't have much time today to think about, but only one method can be to use @MAXRANGE

    DIFFICULTY (other members to set, 'Dec')

    'MemberToStoreAgainst' = @MAXRANGE("MemberToFindMaxRangeFor","2009:"2011");

    ENDFIX

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to get the max of an element value selected iota AF Max.

    Hello community,

    Let me explain the scenario.

    We have a workbook of discoverer, who have several reports. These reports extract information from multiple views built specifically to retrieve information in several tables. So far, quite normal.

    Like any other report you can build these views, you can select the elements (columns) that you will use to create the report. Some of these elements (columns) are selected with the function MAX aggregate for this element; is that to say, instead of the profit of the item, and then click the SUM aggregation function, select the MAX aggregate function. With this option, we can get limit the number of search results.

    In our case, we have created a report that shows the items that we have in our stock, for each item, the report shows the sum of kilograms, the average price, its value (the sum of the average price x kilograms) for each element of the family, and we want the report to display for each item (remember that each element is a line in the report or folder) the largest number of transaction_id (of which there been selected using MAX aggregate function for the selected item), but a kind of transaction types.

    Let's see an example:

    Family | Product name | Sum of the kgs. | Units | Average price | Value of stock. Month | Year | Transaction ID | Type of transaction | Date of movement
    4420 | ALUMINA PS - M BB720 | 97.680,000 | KG | 44737 | 43.699,10 | 04. 10. 7740531 | Finalización Conjunto WIP | 16/12/2009
    4420 | ALUMINA PS - M BB720 | 47.760,000 | KG | 44737 | 21.366,39 | 04. 10. 8100110 | EXCESS | 31/03/2010
    4420 | ALUMINA PS - M BB720 | 97.680,000 | KG | 44737 | 43.699,10 | 04. 10. 8201603 | EXCESS | 30/04/2010

    Considerations:

    The value you see in the Transaction id is the maximum value that the field have; is that to say, each of the types of transactions, it shows the highest (last) transaction that id. looking at the example, the problem now is that we want to pocket the result a llitle little more. We want the report to show only from each product name or transaction id higher, either the date of circulation higher (as in the example above matches the transaction id 8201603 that have the highest movement 30/04/2010 - date).

    I stopped at that point because I don't see how to filter the data to get the result we want.

    Any suggestion or help would be appreciated, cause honestly, I don't see how.

    Thanks in advance.

    Luis.

    Hi Luis
    In order to get the last day of the month, given a year and month as strings, you will need to convert the strings to a date. Assuming you have a two-digit month and, presumably, a 2 digit, with the year 2000 year and more, then you need to start with a date and let's start with the first day of the month like this:

    To_date ('01' |: month: year, 'DDMMYY')

    You can use the ADD_MONTHS function to spend the month by one and then if you subtract 1 from that you will end up with the last day of the month.

    EndofMonth = ADD_MONTHS (TO_DATE ('01' |: month |: year, 'DDMMYY'), 1)-1

    You can also use the LAST_DAY function like this:

    EndofMonth = LAST_DAY (TO_DATE ('01' |: month |: year, 'DDMMYY'))

    Best wishes
    Michael

  • How to get the number of elements of layer?

    I have a script that creates a number of rectangles based on an incoming file name.  There may be a box, it could be 5.  The script puts these rectangles to page 2 (myPage2) on the layer "icons".  There are other items on myPage2 I want to count, so put them on their own layer.

    How can I get a count of elements on this layer?  I tried:

    var myCount = myDocument.layer.count("Icons");
    

    This does not return the correct value.

    stuck.

    Using the ole noggin'!

    var iconLayer = myDocument.layers.add({name:"Icons"});
    var myCount = iconLayer.pageItems.length;
    alert(myCount);
    

    As it says somewhere in the literature of Adobe "Variables make life easier...". »

  • How to get the index of element of constant of cluster

    Is it possible to programmatically determine the index (order) of a particular item in a constant of cluster (typedef)?  The cluster is a group of commands, using the control [] array is not an option.

    It seems that this would be an operation of property, but as there are a no "references" for control objects (is there?), there is no properties of control objects.  I use clusters of risk much.  I struggled with the same problem trying to retrieve cluster of clusters of control element names (all roads lead to OpenG :-) don't want to install VIPM :-().

    I use a digital video recorder with a bunch of berries to share data between an application and use in the structures of the element of the Place to read/write tables. Each table (all the bool or slna) represents an array of values to write to the output of the modules (digital and analog).  Usually I only update tables in a loop and read in several screws/loops.

    From the beginning, I stored the data in table form, but later in development, I created typedefs of cluster for clarity when using the data in a FP VI (especially when you read the data in the table and the display on the indicators).

    The exception to the rule of write-once/read many is when I just want to set or clear a single bit BOOL.

    Attached is a picture showing 2 ways to do the same.

    The structure of the DVR read/write on the RIGHT illustrates how I currently updating a single element of an array of BOOL.  In particular, I want to bit - 2 a table named "bOutputCmds".  [bOutputCmds] is an element of a group named "IoCluster" and the "IoCluster" shared across the application by a DVR named 'IoDataRef '.  Safe to update the value of the wick requires 3 operation in Place (in Place DVR R/W in Place unbundle and in square array Index).

    It works very well.  However, the operation requires specifying the index of the little interest, in this case, "2".  I could assign constants for all the special bits, but it would seem more appropriate to enjoy for typedefs that I created. Typedefs allow me to make changes to assignments of IO and describe the configuration in one place.  DVR R/W element on the LEFT illustrates a way to update a single bit (safely) a cluster element name.

    Retrieve the index of the "bLoadEna" item (2) of the typedef of cluster used on the LEFT would make the solution on the much cleaner RIGHT.

    My backup is to replace all the paintings that I originally put in the cluster shared with the individual clusters later I so carefully set or replace all command non - clusters with clusters of the indicator. Or the other works perfectly. For the most part, I'm technically curious because I tend to bang against the limitations of the control clusters quite often.  I seem to be a programmer of NON-INTERFACE in a world of the user interface.

    In fact, my last statement was rhetorical, but it is really quite real.  My request is a controller shipped without a head, so I don't no need or use many controls.  Maybe I should think about some before picking on clusters of risk...

    Fact.

    Thank you

    Peter

    Use the tools of my favorite library, VariantDataType library, found at vi.lib\utility\VariantDataType, as shown:

    The functions used here are "GetClusterInfo" and "GetTypeInfo."

  • How to get the Max value with other columns data also.

    Suppose that a query is covered with the data as

    Time of ID
    01 07/12/2014
    02 07/05/2014
    03 16/07/2014
    04 07/07/2014

    I need to get the ID and time to time max.
    that is, should I get
    Time of ID
    03 16/07/2014

    To do this, I wrote a query that gives me necessary data. But I thought that's the best way?
    Is it an effective way to get this data?
    My query that returns the data required is:

    SELECT ID, MAX_DT FROM
    (
    Select 'DUMMY', ID, TIME1, MAX (TIME1) OVER (PARTITION 'DUMMY') AS MAX_DT FROM TAB1
    WHERE ID IN (BLAH BLAH)
    )
    WHERE MAX_DT = (EDT) 1

    Frank mentioned links


    WITH test_data (id, time) LIKE)

    SELECT 01, to_date('2014/07/12','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 02, to_date('2014/07/16','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 03, to_date('2014/07/16','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 04, to_date('2014/07/07','yyyy-mm-dd') FROM dual

    )

    SELECT id, time

    go (select id,

    time,

    Max (Time) on latest_time (order by time lines between unbounded preceding and following unbounded)

    of test_data

    )

    where time = latest_time

    ID TIME
    3 16/07/2014
    2 16/07/2014

    Concerning

    Etbin

  • How to get the max sequence number when some record exists in the database table

    Hello

    I need to create the sequence that he should leave value max already exists in the table.

    Example:
    I have a table as below:

    ID NAME
    1A
    1 a
    3 C
    4 D


    Now, during the creation of sequence it should start from 5 but I should ' t START WITH 5 hard-code in the sequence to create. Is it possible to do without Hardcoding the max value in the sequence. It automatically brings the value max + 1 for the next data when I insert.


    CREATE THE TEST_SEQ SEQUENCE. NEXTVAL
    START WITH [Max + 1 val of the table]
    MAXVALUE 9999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 20
    ALL;


    Thank you...

    Published by: 998976 on April 18, 2013 04:37

    Published by: 998976 on April 18, 2013 04:38

    Hello

    All the numbers in a CREATE SEQUENCE statement are literals; no other types of numeric expressions are allowed.
    You need dynamic SQL statements to do something like what you want. For example:

    COLUMN     seq_start_col     NEW_VALUE  seq_start
    
    SELECT     1 + MAX (val)     AS seq_start_col
    FROM     table_x;
    
    CCREATE SEQUENCE TEST_SEQ.NEXTVAL
    START WITH  &seq_start
    MAXVALUE 9999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 20
    NOORDER;
    
  • How to get the max avlue P2P for a signal

    Hello!

    I am very new to all of the LabView program and have some problems with very basic need I ask my program.

    I need to measure a signal max P2P and preform that some analysis on it, the problem is that the Amplitude and the measurement VI is for me the P2P each sample given. Is it possible to do this right?

    Thank you

    You can store it in a shift register.

    A shift register is one of the fundamentals of LabVIEW that you should be familiar with. Have you taken any of the tutorials?

  • How to get the MAX 'Initial configurable settings' of IVI driver



  • How to get the workflow rule to copy a picklist value in another field?

    I'm trying to copy the selected value in a list, which we will call "OldField" in the accounts and duplicate exactly in another version of this list of choices, that we will call "NewField" (with all the values in the drop-down list exactly copied). OldField is a required field, but this isn't NewField.

    NewField is configured with a default value of OldField, and I created a new rule of workflow as follows:

    * (IfNull (PRE ("< NewField > '"), 'Y') = 'Y') OR (PRE ("< OldField > '") <>[< OldField >]) *.

    When this condition is met, I created an action to a value equal to NewField * [< OldField >] *.

    When I edit an existing account, it copies the value very well, but when I create a new account record and click on save button duplication, fails to occur.

    Does anyone have any advice as to what I should do to correct my workflow rule?

    Published by: [email protected] on April 3, 2009 08:04

    Add the default value to the new field and check the default post.

  • How to get the value of a particular column column name?

    Hi all

    How to get the column name for a particular column value.
    example:

    create table test (ID number, col2, col3 varchar varchar);

    Insert into test values (1, 'true', 'false');
    Insert into test values (2, 'false', 'true');
    commit;

    I want to choose the name of the data column 'true' with id = 1;

    That is to say) while waiting for answer is "col2". pls help someone.

    This might help:

    DECLARE
       c1 SYS_REFCURSOR;
    BEGIN
       OPEN c1 FOR
       SELECT col2,
              col3
       FROM   test
       WHERE  id = 1;
       --
       FOR c IN (SELECT rownum rn,
                        t2.column_value.getrootelement() name,
                        EXTRACTVALUE(t2.column_value, 'node()') value
                   FROM TABLE(XMLSEQUENCE(c1)) t,
                        TABLE(XMLSEQUENCE(EXTRACT(column_value, '/ROW/node()'))) t2)
       LOOP
          IF c.value = 'true' THEN
             DBMS_OUTPUT.PUT_LINE(c.name);
          END IF;
       END LOOP;
    END;
    
  • How can I get the max of a measurement value

    How can I get the max of a measurement value?

    http://forums.NI.com/T5/LabVIEW/how-can-I-return-the-maximum-value-from-a-voltage-sensor-over/m-p/30...

    I tried the while loop max-min-solution described in this link. But this using my myRio acceleration measurement no longer works. It seems to hang.

    I use the I2C Communication.

    The inner circle while loop is a bad construction.  It will be either executed once, if enter the Boolean value is True, or forever if the value is false.

    Put your records on the timed loop shift and eliminate inside while loop.  Then your code should work.

  • How to get the balance of an element value

    Hello

    I have a requirement to obtain related information with balance. I am able to read the information on the element except balance.how to get the value of the particular item balance.

    for the application-> transfer and process-> queries with trust-> value the month selected and chosen balances button and queries with the obtained item name break it down the value of the balance.

    These values I want in my query.i tried backend with calling package by passing parameters like the number of transfer, balance the id and date but iam getting value "0".

    IAM new to hrms, Please help me on how to get this balance of values

    Thank you

    Hello

    It is not very clear what you want to display in the form of balance for a given range of dates.

    It depends on how you have configured your balances and periods and balance which you are referring.

    The API allows for a given only date that matches the date earned.

    Say, for example, that you have a "basic salary" defined with a "Treatment period assignment to Date" dimension and feed of the element that corresponds to the base salary.

    "If you need get the 'wage base Total' (balance?) for the period February 1, 2015 ' to March 31, 2015", then you need get dates earned for payroll passes made during that period and call the package above with the appropriate settings.

    Another way is by querying the tables/views directly: you can use, for example - it's perhaps easier to your situation:

    Select sum (nvl (pbv.value, 0))

    of pay_balance_values_v the VB.

    where pbv.balance_name = 'base salary.

    and pbv.database_item_suffix = '_ASG_PTD. '

    and pbv.assignment_id =

    and pbv.effective_date between to_date (' 01/02/2015 ',' dd/mm/yyyy')

    and to_date (' 31/03/2015 ',' dd/mm/yyyy');

    Kind regards
    Rajen

  • How to get the 6th element of a C.V. value column

    Hi all

    I use Oracle Business Intelligence 11.1.1.7.131017.

    I have a column with the following formula: C.V. ("Tickets". "Number of tickets"), but since we want to only show the values advocated by the past 6 months and which is an accumulative column, we added the rank function in the filter and placed as: grade (C.V. ("Tickets". " Number of tickets')) < = 6 and for the final formula, we need the minimum value that is placed in 6th place...

    My problem is how to get the value assigned to this position?

    Here's the column values:

    30719 (value I pretend-> min)

    31357

    32025

    32595

    33652

    34616 (I also use this value-> max)

    Any idea on how to get the value placed on tier 6?

    Thanks for the help and have a good week.

    Kind regards

    Frederico.

    I found a solution (poor, but it works)...

    As a minimum I want is always located in the row = 6 I put a case when row = 6, then returns the value I'm pretending, else return 0, so after that I need only the max of all values, as they are 0 or the value that I'm pretending, like this:

    MAX (CASE WHEN (GRADE (C.V. ("Tickets". "Number of tickets')) = 6) THEN of C.V. (FILTER ("Tickets"." Number of tickets' using 'status '. ((("" Resolved "="Resolvido")) END ELSE 0)

    I want to thank you all for the help, normally I post in the forum of the ADF but its good to know I can get a lot of support here as well...

    Many thanks to all,

    Frederico.

Maybe you are looking for