How to extract the values of previous header?

Hello


loading a flat file, I have a table (simplified example) as follows


Interface line Id Type value line Num
1 1 4 header
1 line 1 2
1 2 3 line
1 5 4 header
1 line 19 5
1 line 3 6
1 7 7 header
1 line 66 8
1 33 9 header
1 line 2 10


Can anyone tell me with a single piece of SQL I'm looking for the record header for each line.

for example, in my example

Line 2, 3 = Header 4
Line 5, 6 = header 5
Line 8 = Header 7
Line 10 = Header 33


Thanks for your comments,


Robert.

It's pretty generic:

in my query, replace the Tag with your real Table (I don't have the table!):

SELECT Interface_Id,
       Row_type,
       num,
          'Header = '
       || (SELECT VALUE
           FROM    q1
           WHERE  q1.num = (SELECT MAX(num)
                            FROM    q2
                            WHERE  q2.num < q.num
                            AND    row_type = 'Header')) header
FROM   
WHERE  row_type = 'Line'

Tags: Database

Similar Questions

  • 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;
    
  • How to extract the values inside the jquery element dialogue modal rigion

    Hi all

    My requeriment is

    Click report link open jquey editable modal dialog and display all values with respective ID values.

    1.I used page header HTML code below

    < link rel = "stylesheet" href = " " http://AJAX.googleapis.com/AJAX/libs/jQueryUI/1.7.2/themes/

    "Redmond/jquery - ui.css" type = "text/css" / >

    " < script src =" http://AJAX.googleapis.com/AJAX/libs/jQuery/1.4.2/jQuery.js "> < / script > .

    " < script src =" http://AJAX.googleapis.com/AJAX/libs/jQueryUI/1.7.2/jQuery-UI.js "> < / script > .

    < script type = "text/javascript" >

    $(function() {})

    () $('#ModalForm').dialog

    {

    modal: true,

    autoOpen: false,

    Width: 600

    buttons: {}

    Back: function() {}

    closeForm();

    } ,

    Approve: function() {}

    addPerson();

    },

    Return_For_Correction: function() {}

    addPerson();

    },

    Reject: function() {}

    addPerson();

    }

    }

    });

    });

    function openForm (TrxId)

    {

    Alert (TrxId);

    $s ('P3_x_trx_id', TrxId);

    $('#ModalForm').dialog ('open');

    }

    function closeForm()

    {

    $('#ModalForm_input[type="text"]').val (»);

    $('#ModalForm').dialog ('close');

    }

    function addPerson()

    {

    var ajaxRequest = new htmldb_Get (null, & APP_ID., 'APPLICATION_PROCESS is updateStatus', 0);

    ajaxRequest.add ('P3_status', $v ('P3_status'));

    var gReturn = ajaxRequest.get ();

    If (gReturn)

    {alert (gReturn)}

    on the other

    {ajaxRequest = null;

    closeForm();

    doSubmit ('SEARCH'); }

    }

    < /script >

    2. static html Id - ModalForm region

    3. region html Header-

    < div id = "ModalForm" title = "View details" style = "display: none" >

    4.footer-

    < / div >

    5. in the same page created 'extraction of line auotomatic' process by using the value of key PK P3_trx_id

    6 Jquery modal region is created but not showing values.

    Hi Dan,.

    You must create a separate page for your modal dialog box,

    Call this dialog in the parent page and pass the value modal page in some hidden item and use the value of the element to retrieve details on the modal dialog box.

    1. change your report Page-> under the header HTML

    
    

    2. change the link from which column you want to call the modal dialog box.

    Target: URL

    URL: javascript:f_modalDetails(#ID#);

    instead ID, pass the value that you want to pass to the modal dialog box that shows you the data associated with the selected line.

    3. go to the page of the form (modal dialog)

    Change your close button that closes the modal dialog box.

    Action: Redirect URL

    Target URL: javascript:window.parent.closeModalDialog();

    Close the Model dialog box using the "submit" button press

    4. create a branch on the processing section of the Page of the page of the modal dialog box

    Branch point: After Processing (After computation, validation and Processing)

    Target type: Page of this Application

    Page: Redirect to the same page

    Request: CLOSE_MODAL

    When you press the button: select the Send button

    NOTE: Branch must be before all the unconditional branch on this page

    5. create a dynamic Action on the Page modal dialog box

    Event: Page load

    Action: Run the JavaScript Code

    Code: javascript:window.parent.closeModalDialog();

    Kind regards

    Jitendra

  • How to extract the values of the line full in the bean to support using the primary key

    Hello

    I have a table that has columns as plant_name, business planner email id and identification of email resident engineer. Here, Plant_name is the primary key.

    Now, I have this plant's name slipped and dropped like selectonechoice (drop) on page jsff. In this user can select any name of 1 plant drop down.

    Right now, I can go get plant in backing bean name, but I can't understand how business plan for extraction and identification of email of the engineer resident in this key primary-plant_name at the bean to support.

    Please let me know if anyone has an idea in this regard.

    JDeveloper version 11.1.1.6.0

    Thanks in advance.

    Sneha

    Sneha211 wrote:

    On the jsff page

    required = "#{bindings." Plant.hints.Mandatory}.

    shortDesc = "#{bindings." Plant.hints.ToolTip}.

    ID = "soc1" unselectedLabel = "- Select -"

    autoSubmit = 'true '.

    Binding = "#{backingBeanScope.backingbean.plantbean}" > "

    ID = "si1" / >

    In backing bean

    DCBindingContainer = lBindingContainer

    (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding("SupplierVO1Iterator");

    NewRow row = lBinding.getCurrentRow ();

    String aamplant1 = (String) newRow.getAttribute ("Plant");

    Hi Sneha, you've written code for it

    you have found the current line and the primary key then this line, then why you not not using this same rank to get the other attributes?

    NewRow row = lBinding.getCurrentRow ();

    String aamplant1 = (String) newRow.getAttribute ("Plant");

    String businessPalnner = (String) newRow.getAttribute ("business_planner"); Returns the value of the same line

    Engineer in String = (String) newRow.getAttribute ("engineer");


    OR if your condition is like that-

    you have a primary key field value, but you do not have the corresponding line, then you can get that line and it's attribute by using the primary key value

    See - http://adfgouravtkiet.blogspot.in/2012/10/filtering-of-data-from-vo.html

    Hope it helps

    -Ashish

  • 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 value of QVariantlist

    Hello

    I was trying to understand quoteapp example to implement the sqldata in my application. In this example, they are passing all qvariantlist in groupdatamodel and use it in listview. But I don't want to use listview and want to access the value of a particular column in a table on a page. Anyone can guide me please how?

    I'll try to explain what I did to understand how it works. If you have QVarint or QVariantList, right? So now, print it in console with qDebug().

    You will see something like this.

    QVariant(QVariantMap, QMap(("StationButton", QVariant(QString, "") ) ( "StationButtonSelected" ,  QVariant(QString, "") ) ( "StationIcon" ,  QVariant(QString, "0332.jpg") ) ( "StationName" ,  QVariant(QString, "JD Inside") ) ( "StationStreamURL" ,  QVariant(QVariantMap, QMap((".data", QVariant(QString, "http://www.panel-streaming.com/tunein.php/jdinside/playlist.pls") ) ( "type" ,  QVariant(QString, "pls") ) )  ) ) ( "StationURL" ,  QVariant(QString, "http://www.jdinside.com/") ) )  )
    

    So now if I would get Station stream URL type I need to do the following

    QString currType = data.valueQVariantMap>.value("__StationStreamURL__").value ()QVariantMap> ()QString.value("t__ype__").value > ();

    As you can see the first structure is QVariantMap, so we use data.velue() to get it. Then is StationStreamUrl, as QVariantMap and we can get type and convert it to QString. It's something like cabbage, where you need to remove all the layers.

    It will be useful. If not give me what structure you have and I'll try to help you.

    Thank you.

  • How to extract the value of the signature (appearance)

    I asked my users to create an appearance for their signature showing that the 'name' and 'logo '.  I want to create a script to verify this aspect and display an alert if they did not follow the rule to create a signature. the value property indicates the word < < dict > > is it possible to delete a signature via javascript, is it not meet requierments, prevent the signing, forcing an appeareance or just change the appearance by default so that the user should not change?

    No, you can do most of this with JavaScript. You have access to is the data in an object SignatureInfo returned by the field.signatureInfo method:

    http://livedocs.Adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.756.html

    With the field.signatureSetSeedValue method, you can preconfigure a specific field to use a specific named appearance, but I don't know how you would handle this for multiple users because their appearance signature names would be probably different: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.757.html

  • How to extract the value of the element as an array in javascript

    Hi all

    I want to do some calculations on the value entered by the user in the textfield of a tabular presentation, how can I retrieve the value of the element as an array in javascript?

    I use as a normal, do not use in the form of apex_item.

    I can pass the current value of the textfield to the function using 'this' as a parameter, but how can I retrieve the value of other lines of the same column?

    Thank you
    Tauceef

    If it is a page element wouldn't be better to make a calculation of point page when onload of the page? Just do a SQL as select sum (col1) of dual nationality or whatever is your table/column?

  • ID - value in XML format. How to extract the value based on the id?

    Hello

    I have a XML type

    < root >
    < resource >
    < id > 123 / < ID >
    < value > CBA < / value >
    < / resource >
    < resource >
    < id > 456 / < ID >
    def < value > < / value >
    < / resource >
    < / root >

    It is stored in a column of XMLTYPE as a CLOB.

    Now, I want to get a particular value based on one id.

    I tried to use the following syntax

    ([Select case when existsnode(x.XML_CLOB,'/Root/Resource[Id="123"]') = 1
    then extractValue(x.XML_CLOB,'/Root/Resource/Value')

    but "/ Root / / value of resource" can mean either of the 2 values. How to solve this?

    Hello

    If the element 'id' is unique you just specify XPath to the 'value' on the basis of extractvalue (given that you are pregnant of a single node):

    WITH x AS (
     SELECT xmltype(
     '
     123abc
     456def
     '
     ) xml_clob
     FROM dual
    )
    SELECT extractvalue(x.xml_clob, 'root/resource[id="123"]/value')
    FROM x
    WHERE ...
    ;
    
  • How to extract the value of the field in variable

    I want to be able to read the value of the field out of the browser and store in a variable for I can manipulate it. I tried several methods, that which no I can't find the proper syntax. My last is the following:

    . . Solve ("postal code", "/ip/", Source.DisplayContent, 1);

    I assumed that the Group should be able to draw from this, but it does not solve. I think my problem is the regular expression or index (that I had with the null value). Any help would be greatly appreciated as I have a tight deadline to achieve. Thank you.

    -John

    Hi John,.

    Why are you using web.window? Surely, you would use web.element?

    Concerning

    Wayne.

  • XMLTABLE - how to extract the value of the escape of a node as-is sequence

    Hello

    How can I me XMLTABLE leave the string value of a node like the version with escape sequence, rather than unescaping it?

    E.g.:
    select extract(xmltype('<root><test>&lt;unset&gt;</test></root>'), '/root/test/text()').getstringval() col1 from dual
    union all
    select col1
    from   xmltable('/root' passing xmltype('<root><test>&lt;unset&gt;</test></root>')
                    columns
                    col1 varchar2(20) path 'test');
    
    COL1                                                                            
    ---------------------
    &lt;unset&gt;                                                                   
    <unset>     
    NB. you will need to hit rΘpondre α and then quote my post to see the actual text; For the life of me, I can't get the forum properly displays things. In short, the string returned by the EXTRACT is escaped, while the XMLTABLE chain is unescaped.


    ETA: I looked through the standards xml from the list of available functions, and nothing seems relevant. {noformat} * scratches head * {noformat}

    Published by: Boneist on March 19, 2013 14:11

    You can emulate what do I EXTRACT / getStringVal () by projecting the node text() as XMLType and type-casting to VARCHAR2 in the SELECT clause:

    SQL> set scan off
    SQL>
    SQL> select cast(col1 as varchar2(20))
      2  from xmltable(
      3         '/root'
      4         passing xmltype('<unset>')
      5           columns col1 xmltype path 'test/text()'
      6       ) ;
    
    CAST(COL1ASVARCHAR2(20))
    ------------------------
    <unset>
     
    
  • How to extract the value of a tag XML using regular Expressions

    We get a response XML from a WEB SERVICE.

    I convert it to VARCHAR2.

    Now, I want to get the real answer that is inside the tag of the response.

    I tried this:

    DECLARE

    V_1 VARCHAR2 (30000): = ' < soap: Body > < ns:ProcessArgusFeedsResponse xmlns:ns = "urn: PegaRULES:SOAP:ArgusToPegaFeeds:Services" > ' |

    '< response > good < / answer >< / ns:ProcessArgusFeedsResponse > < / soap: Body > ';

    v_response VARCHAR2 (100);

    BEGIN

    DBMS_OUTPUT. PUT_LINE (V_1);

    v_response: = REGEXP_SUBSTR (v_1, ' / < >(.+?) < \/Response > answer /');

    dbms_output.put_line (v_response);

    END;

    It does not work.

    Any help would be greatly appreicated.

    Hello

    user12240205 wrote:

    We get a response XML from a WEB SERVICE.

    I convert it to VARCHAR2.

    Why?  XML has its own native ways of analysis; Why not use them?

    If you use regular expressions, then REGEXP_REPLACE, as shown above, is a good option in Oracle 10, but starting in Oracle 11.1, you can use REGEXP_SUBSTR like this:

    REGEXP_SUBSTR (v_1

    , '(.+?)'

    1

    1

    NULL

    1

    )

    The 6th argument is like a backreference; "He tells REGEXP_SUBSTR did not return to the entire organization, but only the part inside the 1st left '(' et correspondant à sa droite).

    The '?' to make it non-greedy is necessary only if v_1 can contain more than one response.

    Now, I want to get the real answer that is inside the tag of the response.

    I tried this:

    DECLARE

    V_1 VARCHAR2 (30000): = "" |

    'Good';

    v_response VARCHAR2 (100);

    BEGIN

    DBMS_OUTPUT. PUT_LINE (V_1);

    v_response: = REGEXP_SUBSTR (v_1, ' /(. +?)) <\ esponse="">/');

    dbms_output.put_line (v_response);

    END;

    It does not work.

    That's because it's looking for a slash ("/") before the '' tag and another after the ' tag.

    The backslash ("\") is not necessary here, but it is not nothing wrong.

  • 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 get the value of an xml element attributes

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

    I'm trying to parse an XML document

    < response >
    < well uwi = "102112900816W400" > < / well >
    < production >
    < PRODUCING_ENTITY >
    < NUMBER YEAR = '2009' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2010' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2011' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2012' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < / PRODUCING_ENTITY >
    < / production >
    < / well >
    < well uwi = "100092900816U400" > < / well >
    < production >
    < PRODUCING_ENTITY >
    < NUMBER YEAR = "1999" >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2000' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2001' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = "2003" >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < / PRODUCING_ENTITY >
    < / production >
    < / well >
    < / answer >

    For the purposes of the practice, I have saved this in my table tdw_test_xml_files;

    My goal is to get the /WELL/@uwi and /YEAR/@NUMBER

    UWI YEAR
    ------ ---------------
    102112900816W400 2009
    102112900816W400 2010
    102112900816W400 2011
    102112900816W400 2012
    100092900816U400 1999
    100092900816U400 2000
    100092900816U400 2001
    100092900816U400 2003


    I tried this... but I can't get the value of the attribute for the element < YEAR >

    Select r.uwi, r.year
    of tdw_test_xml_files.
    XMLTABLE
    (
    "for $WELL in $ response/WELL/good.
    for $DEPT to $UWIIDX in $WELL, Production, PRODUCING_ENTITY, YEAR
    return < RESULT >
    University of the West Indies West <>{fn:data($WELL/@uwi)} < / UWI >}
    {
    $WELL/production/PRODUCING_ENTITY/YEAR [$UWIIDX]-> (I don't know how to extract the value of the attribute here)
    }
    < / RESULT > '
    passing FILECONTENT as 'GOOD '.
    columns
    UWI VARCHAR (50),
    YEAR vARCHAR2 (24)
    ) r
    /


    If I do this; I get the Cartesian plan result set, which is not my goal

    SELECT xtab.*, xtab2.*
    OF tdw_test_xml_files, XMLTable (' for $i in/Response/Well)
    Return $i"
    PASSAGE filecontent
    Uwi varchar2 COLUMNS (50) PATH'@uwi'
    rn for ORDINALITE
    ) xtab
    , XMLTable (' for $i in/Response/Well/Production/PRODUCING_ENTITY/YEAR)
    Return $i"
    PASSAGE filecontent
    COLUMNS year varchar2 (50) PATH'@NUMBER'
    ) xtab2;

    Any help will be highly appreciated thanks...

    I'm just curious to know how make the query now in unique XMLTable, not that I am forced by using x number of xmltable; - P, just look more clean...

    Here goes:

    SQL> SELECT x.*
      2  FROM tdw_test_xml_files t
      3     , XMLTable(
      4         'for $i in /Response/Well
      5            , $j in $i/Production/PRODUCING_ENTITY/YEAR
      6            , $k in $j/MONTH
      7          return element r {
      8            $i/@uwi
      9          , element year  {data($j/@NUMBER)}
     10          , element month {data($k/@NUMBER)}
     11          }'
     12         passing t.filecontent
     13         columns uwi   varchar2(50) path '@uwi'
     14               , yr    varchar2(4)  path 'year'
     15               , mon   varchar2(2)  path 'month'
     16       ) x
     17  ;
    
    UWI                            YR   MON
    ------------------------------ ---- ---
    102112900816W400               2009 1
    102112900816W400               2009 2
    102112900816W400               2009 3
    102112900816W400               2010 1
    102112900816W400               2010 2
    102112900816W400               2010 3
    102112900816W400               2011 1
    102112900816W400               2011 2
    102112900816W400               2011 3
    102112900816W400               2012 1
    102112900816W400               2012 2
    102112900816W400               2012 3
    100092900816U400               1999 1
    100092900816U400               1999 2
    100092900816U400               1999 3
    100092900816U400               2000 1
    100092900816U400               2000 2
    100092900816U400               2000 3
    100092900816U400               2001 1
    100092900816U400               2001 2
    100092900816U400               2001 3
    100092900816U400               2003 1
    100092900816U400               2003 2
    100092900816U400               2003 3
    
    24 rows selected
     
    
  • How im can extract the value of the persistence of virtual machine disk?

    Dear friends

    How im can extract the value of the value of the persistence of disks of virtual machines?

    IM using the bellows of the order, I have a if to check if the disks are independent or not

    but im only want values of the persistence of the column to use in my script

    Get-disk hard - vm machine01

    CapacityGB persistence Filename

    ----------      -----------                                                    --------

    10 000 persistent [LUN2] RJ7469SR039/RJ7469SR039.vmdk

    8 000 persistent [rate2] RJ7469SR039/RJ7469SR039_1.vmdk

    Thank you

    Almir

    In your example, you just use Select-Object

    Get-disk hard - vm machine01 | Select the Parent, persistence

    The parent is the name of the virtual machine

Maybe you are looking for

  • space requirement: this library file to move?

    Hi all I have all my photos on Mac and on my backup unit Last year, after buying my new MacBook, I did some work to migrate from old to new. Now I need free space on Hd on my Mac and my/images folder I have these files: -' Library foto' gb75 (also I

  • How can I add a search bar to search for a file on hard drive engine?

    I want to add a search engine to the search bar to an XML file on my hard drive. "Manage search engines" in the drop down menu bar look to the bottom of the list is displayed to allow adding search engines from web sites. Thank you.

  • Queues do not work in my object-oriented design

    I'm developing an application in real time, and I'm using an object-oriented approach. The design model is similar to the framework of the actor, but made to measure. The class structure is configured to support several different subsystems, with the

  • install new PS6510e - no communication on Iscsi network

    Getting desperate here now. bought refurbished ps6510e of third-party reseller - have been categorically denied access to the site of dell for support on that basis. connected to 2 servers R720 via grouped 10 gb SFP + cables through a switch of 8024F

  • Name complete change of the server to the title of the material

    is it possible to change the display name of the LIVE / blade PRODUCTION equipment--> Chasis--> servers to our own denomination of standards. The screenshot of current names is attached. UCS Manager Version 2.1(3a)