All paths between 2 nodes

Hello

Can you get it someone please let me know how can I achieve this?

I want to know all the paths between A Source node and the node of Destination B.

I donot want the shortest way but all paths between the 2 nodes.

Also I donot have no weight/cost by any path. (The graph is a directed graph)

Kind regards
Pantxo

Hello

Maybe this:

Scott@my11g SQL>l
  1  with links(n1,n2) as (
  2  select 'A','B' from dual
  3  union all select 'A','C' from dual
  4  union all select 'B','C' from dual
  5  union all select 'B','D' from dual
  6  union all select 'D','G' from dual
  7  union all select 'C','G' from dual
  8  union all select 'D','I' from dual
  9  union all select 'C','E' from dual
 10  union all select 'E','F' from dual
 11  union all select 'F','G' from dual
 12  union all select 'F','H' from dual
 13  )
 14  select pth
 15  from (
 16  select connect_by_root(n1) || sys_connect_by_path(n2,'>') pth ,n2
 17  from links
 18  start with n1='A'
 19  connect by nocycle prior n2=n1
 20  )
 21* where n2='G'
Scott@my11g SQL>/

PTH
----------------------------------------
A>B>C>E>F>G
A>B>C>G
A>B>D>G
A>C>E>F>G
A>C>G

Tags: Database

Similar Questions

  • Calculate the fastest path between 2 nodes with the data model for the Oracle network

    Hi all,

    I have Oracle 10 g 2.

    My problem is the following:

    I created a network named ITALIA_NET in the data model for the Oracle network.
    The table of links of this network is named: ITALIA_NET_LINK$.
    The table of the nodes of this network is named: ITALIA_NET_NODE$.

    The table ITALIA_NET_LINK$ contains a field named COST that contains links (in meters) lengths.

    I've already calculated the SHORTEST PATH between two nodes of the network, by using the method of shortestPath() (using the Java API) as shown on "Pro Oracle Spatial for Oracle Database 11 g" manual. Infact, this method makes reference to the COST field for $ ITALIA_NET_LINK to make this calculation.

    Now, I want to calculate the FASTER PATH between two nodes of the network. I have the links (in hours) travel time to make this calculation.

    My idea is to create a new field in ITALIA_NET_LINK$ named Cost2 containing the travel time from the links and then do the math by using the shorthestPath() method, referring to the Cost2 field to $ ITALIA_NET_LINK COST field instead.
    By default, I know that the shorthestPath() method returns the COST field for $ ITALIA_NET_LINK. Is possible to change this setting and do that this method refers to the Cost2 field?

    In the alternative, is another way for the calculation of the fastest way?
    I want to leave the creation of another network as last solution, because I will have other costs of field (Cost3, cos4t,...)

    Thank you much in advance.

    Your approach is good. You will have two networks and you can read them in memory and analyze of shortest path. The shortestPath method is static for the class of NetworkManager. You can use the same method for both networks, once they are read into memory.

    ...
    read the network with time as cost of link
    NetTime network = NetworkManager.readNetwork (dbConnection, 'ITALIA_NET_TIME');
    read the network length as cost of link
    Network netLength = NetworkManager.readNetwork (dbConnection, 'ITALIA_NET_LENGTH');

    calculate the quickest way
    PathTime path = NetworkManager.shortestPath (netTime, startNodeID, endNodeID);
    calculate the shortest path
    PathLength path = NetworkManager.shortestPath (netLength, startNodeID, endNodeID);
    ...

    In the future, if you upgrade to 11g, network data model provides a load on demand (LOD) API that loads only the scores of necessary network in memory during the analysis. This command removes the restriction of the memory of the 10g (in memory API you use) API. API of LOD can handle very large networks and offers more features analysis and modeling capabilities.

    The following link contains the tutorial of NDM LOD API ready for download. Just for your information.
    https://spatial.SampleCode.Oracle.com/servlets/ProjectProcess?PageID=0Zl7oV

    Kind regards
    Jack

  • Find paths between two nodes using SQL sort by cost

    Hi gurus,

    I want to find all paths from the source node to the target node that will be sorted by the cost. I don't know if it was possible with the SQL statement. How to start with this query? The script to create the tables and data are given below:

    ------------------------------------------------------------------------------------------------------------------
    create table of nodes (nodeId int Primary Key, nodeName varchar (50));

    create paths of table (pathId int Primary Key, int fromNodeId, int toNodeId, int cost);

    insert into a values (1, 'ISL') nodes;
    insert into a values (2, "LHR") nodes;
    insert into a values (3, 'HYD') nodes;
    insert into a values (4, 'FLS') nodes;
    insert into a values (5, 'MUL') nodes;
    insert into a values (6, "KHI") nodes;
    insert into a values (7, 'QT') nodes;

    insert into values of paths (1,1,3,20);
    insert into values of paths (2,1,5,10);
    insert into values of paths (3,1,7,80);
    insert into values of paths (4,2,4,10);
    insert into values of paths (5,3,4,40);
    insert into values of paths (6,3,5,20);
    insert into values of paths (7,3,6,10);
    insert into values of paths (8,6,7,30);
    insert into values of paths (9,6,5,30);
    insert into values of paths (10,6,3,10);
    insert into values of paths (11,7,2,20);
    insert into values of paths (12,5,4,40);
    insert into values of paths (13,5,7,40);

    ----------------------------------------------------------------------------------------------------------------------------------
    Assume that the source = ISL and QT= target, there are different paths to QT ISL:

    Path relative cost DSB #.
    ==== ================================= =================
    1 ISL-> Multimedia-> QT 50
    2 ISL->->-> QT 60 KHI HYD
    3 ISL-> QT 80
    4 ISL-> HYD-> Multimedia-> QT 80
    5 ISL-> HYD at KHI-> Multimedia-> QT 100

    This gives us all possible paths, sorted by price.

    No indication or help will be appreciated.

    Thanks in advance and best regards

    Bilal

    Published by: naive2Oracle on February 11, 2011 09:59
    select  ltrim(sys_connect_by_path(nodeName,'->'),'->') path,
            extractvalue(dbms_xmlgen.getXMLtype('select '|| sys_connect_by_path(cost,'+') ||' cost from dual'),'/ROWSET/ROW/COST') - cost cost
      from  paths p,
            nodes n
      where p.fromNodeId = n.nodeId
        and nodeName = 'QT'
      start with nodeName = 'ISL'
      connect by nocycle fromNodeId = prior toNodeId
                     and prior nodeName != 'QT'
        order by cost
    /
    
    PATH                                                              COST
    -------------------------------------------------- -------------------
    ISL->MUL->QT                                                        50
    ISL->HYD->KHI->QT                                                   60
    ISL->HYD->MUL->QT                                                   80
    ISL->QT                                                             80
    ISL->HYD->KHI->HYD->MUL->QT                                        100
    ISL->HYD->KHI->MUL->QT                                             100
    
    6 rows selected.
    
    SQL> 
    

    SY.

  • Hierarchical Oracle query help needed - path between the crux of two brothers and sisters

    I want to find the path between two nodes of oracle hierarchical Table.

    Consider the following case-
    NodeId - ParentId
    =============
    1 > > > > > > 0
    2 > > > > > > 1
    3 > > > > > > 2
    4 > > > > > > 3
    5 > > > > > > 0
    6 > > > > > > 5
    Here I want to query the database table that if there is a path between nodes 3 and 5?
    The previous query you provided work upwards to the root node.

    Here is my expected result, 3-> 2-> 1-> 0-> 5

    Yet once if I have a query in the table to get the path between 1 and 3, I want to get out of the way - next
    1-> 2-> 3

    Therefore, the query works in both cases. Where ADI root can act as an intermediate or no node.

    Can you please guide me how I can get it?

    Thank you.

    Hello

    user13276471 wrote:
    I want to find the path between two nodes of oracle hierarchical Table.

    Consider the following case-
    NodeId - ParentId
    =============
    1 >>>>>> 0
    2 >>>>>> 1
    3 >>>>>> 2
    4 >>>>>> 3
    5 >>>>>> 0
    6 >>>>>> 5
    Here I want to query the database table that if there is a path between nodes 3 and 5?
    The previous query

    What application is this? If you're referering to another thread, then post a link, such as {message identifier: = 10769125}

    you provided work upwards to the root node.

    Here is my expected result, 3--> 2--> 1--> 0--> 5

    Yet once if I have a query in the table to get the path between 1 and 3, I want to get out of the way - next
    1--> 2--> 3

    Therefore, the query works in both cases. Where ADI root can act as an intermediate or no node.

    Can you please guide me how I can get it?

    I think you want something like this:

    WITH     bottom_up_from_src    AS
    (
         SELECT     nodeid
         ,     parentid
         FROM     table_x
         START WITH     nodeid      = :src_nodeid
         CONNECT BY     nodeid   = PRIOR parentid
    )
    ,     bottom_up_from_dst     AS
    (
         SELECT     *
         FROM     bottom_up_from_src
        UNION ALL
         SELECT     parentid     AS nodeid
         ,     nodeid          AS parentid
         FROM     table_x
         WHERE     nodeid     NOT IN (
                                          SELECT  nodeid
                                   FROM    bottom_up_from_src
                                      )
         START WITH     nodeid        = :dst_nodeid
         CONNECT BY     nodeid        = PRIOR parentid
    )
    SELECT      :src_nodeid || SYS_CONNECT_BY_PATH (parentid, '-->')     AS display_path
    FROM       bottom_up_from_dst
    WHERE       parentid     = :dst_nodeid
    START WITH  nodeid     = :src_nodeid
    CONNECT BY  nodeid     = PRIOR parentid
    ;
    

    This will show how you can get it from: src_nodeid at dst_nodeid, moving to the top or to the bottom of a hierarchy at a time step. This will work regardless of the fact that


    • : src_nodeid is the ancestor of the: dst_nodeid, or
    • : src_nodeid is a descendant of: dst_nodeid, or
    • both: src_nodeid and: dst_nodeid are the descendants of another node (e.g. 0).

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0). It is always important, but particularly so with CONNECT BY queries, because each version since Oracle 7 had significant improvements in this area.
    See the FAQ forum {message identifier: = 9360002}

  • Connectivity between two nodes of Virtual Box

    For a few days, I try to establish the network connectivity between two nodes OEL (Oracle Enterprise Linux) in Oracle Virtualbox. I tried everything I have found Google, but still nothing works, everytime I try to ping from one node to another node Hostname/IP is showing unknown host. All the advice everyone here will be great for me.

    Published by: 918868 on October 30, 2012 02:30

    When you create a virtual machine, by default VirtualBox allows virtual network card and selects the "Network Address Translation" (NAT) mode for it. In this way the guest can connect to the outside world using the networking of the host and the outside world can connect to services on the feedback that you choose to make visible outside of the virtual machine.

    This default configuration is good probably 95% of users of VirtualBox. VirtualBox is, however, extremely flexible in how it can virtualize networks. It supports multiple virtual NICs per virtual machine, the first four that can be configured in detail in the Manager window. Additional network cards can be configured on the command-line with VBoxManage.

    Source: http://www.virtualbox.org/manual/ch03.html#settings-network

    For more details, please see:

    Virtual networks
    http://www.VirtualBox.org/manual/CH06.html

    Concerning
    Girish Sharma

  • How to remove a path between two anchor points

    Hello

    everything is in the title,

    could you tell me please how to remove a path between two anchor points without using the tool Eraser path?

    When I select these two folders and press to remove all disappeared.

    PS: I want to keep the anchor after the removal

    Thank you

    with the Selection tool direct (white pointer), click the path segment (no points) or select slide above without going on something else and tap on delete.

  • Regular expression, replace all commas between double quotes ONLY

    Hello

    I want to remove all commas between double quotes:

    I tried under model, but it does not replace all if we have more than one comma in double quotes.

    SELECT REGEXP_REPLACE (123, "45.6" Hello, "John, Mike, Marc", 456, "-Anne, Anna"', ' "([^"]*),([^"]*)" ', '"\1;\2" ', 1, 0) suite

    FROM DUAL;

    Result

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

    123, '45; 6"," Hello, "John, Mike;" "Marc", 456, "Anne-; Anna.

    the first comma between 'John, Mike; Marc"is not replaced...

    Recursion can do if you insist on the SQL solution

    with

    correct (INP, orig, CNT, res, Step) as

    (select str,

    substr(STR,2),

    -case when substr (str, 1, 1) = ""' then 1 else 0 end,

    substr (STR, 1, 1),

    1

    of (select 123, '45.6,' Hello, ' John, Mike, Marc ", 456, '-Anne, Anna', 'single_value' ' str of union double all the)

    Select "123456789" across double Union

    Select ' ""' of all the double union

    Select "" 123,456,789"" Union double all the

    Choose 123, '45.6,' Hello, ' John, Mike, Marc ", 456, 'Ann-Marie, Anna', 'unique value' ' double str

    )

    Union of all the

    Select the inp

    substr(orig,2),

    CNT + case when substr (orig, 1, 1) = ""' then 1 else 0 end,

    RES | cases where substr (orig, 1, 1) = ','

    so to case when mod(cnt,2) = 1

    then ' ~'

    else «»

    end

    of another substr (orig, 1, 1)

    end,

    Step + 1

    Rectifier

    where orig is not null

    )

    Select the inp, res

    Rectifier

    where the orig is null

    INP RES
    "" ""
    123456789 123456789
    "123456789". "123 ~ 456 ~ 789".
    123, '45.6' Hello, ' John, Mike, Marc ", 456, '-Anne, Anna', 'single_value '. "123," "45 ~ 6 ', Hello," John ~ Mike ~ Marc ", 456," Anne-~ Anna ',' single_value '.
    123, '45.6' Hello, ' John, Mike, Marc ", 456,"Ann-Marie, Anna","unique value ". "123," "45 ~ 6 ', Hello," John ~ Mike ~ ~ ~ Marc ', 456,' Anne-Marie ~ Anna "," unique value ".

    Concerning

    Etbin

  • Retrieve all dates between 2 date

    My dear

    If I have 2 Dates I need sql give any dates between these taches\

    for example

    I have table tab1 in this neck of table called hiredate

    I want to get the lowest dates and max then give all dates between these 2 date

    If the lowest date = 01/01/2014

    and the date max = 20/05/2014

    then sql retive

    01/01/2014

    01/02/2014

    01/03/2014

    .....

    ...

    ..

    TO

    20/05/2014

    Thanks in advance

    Hello

    user222 wrote:

    My dear

    If I have 2 Dates I need sql give any dates between these taches\

    for example

    I have table tab1 in this neck of table called hiredate

    I want to get the lowest dates and max then give all dates between these 2 date

    If the lowest date = 01/01/2014

    and the date max = 20/05/2014

    then sql retive

    01/01/2014

    01/02/2014

    01/03/2014

    .....

    ...

    ..

    TO

    20/05/2014

    Thanks in advance

    If you want rows with the date the lowest, highest and any date between these two then:

    SELECT *- or whatever the columns that you want to

    OF tab1

    WHERE hiredate IS NOT NULL;

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.

    In the case of a DML (such as INSERT) operation the sample data should show what look like the paintings before the DML, and results will be the content of the or a modified tables after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • Change all paths in a layer without using a layer appearance attribute

    I suspect I did it wrong for a while, but I don't know how to do it right.

    If I want to change the appearance of all paths in a layer (say, something simple to change their line color), it is pretty easy to target in the layer by clicking on the button of the target layer. However, when I do change (as outline in orange color setting), it appears in the appearance of the layer itself - each element within the layer are not orange line directly in their appearance attributes, they just inherit the appearance of the layer attributes.

    I understand that this is the intended behavior, but I found that it's easier for me to avoid the layer effects and have just each element in a layer to be autonomous and show all its own attributes of appearance without something inheriting from the upper layer (I tend to forget and be confused about when they appear). However, I don't know how to force the appearance of a layer down to its subcomponents (likely the compensation of the appearance of the layer to avoid duplication). Is it some commands I'm missing?

    Now how I do it, it's all in the layer by using the layer target, then UN-target target the highest member of the layer. This allows me to change the appearance of all items in the layer (except the one at the top) without changing the appearance of the layer itself. Then I do the top separately. Seems kludgier than she should be. Any help? Thank you.

    tqrtuomo, I was confused by the present, sometimes as well and made the same thing you describe. I think the key, when selecting on a given layer or group is to click on the 'right' of the 'Target' button in the layers panel to the layer/group level. Make sure that there is no 'circle' around the target button or appearance will be assigned to the layer/group.

  • Select all dates between two fields txt. How?

    In a slider form 6i, I need to select all dates between two dates provided. I have two fields text Fld1 and Chp2 with the data type date. There is no table behind the two fields.
    For example
    ': FLD1: = MARCH 1, 2013;
    ': CHP2: = MARCH 10, 2013;

    Now I have to choose all dates between 01-mar-2013 and 2013-mar-10 '. How to do?

    Gul says:
    In a slider form 6i, I need to select all dates between two dates provided. I have two fields text Fld1 and Chp2 with the data type date. There is no table behind the two fields.
    For example
    ': FLD1: = MARCH 1, 2013;
    ': CHP2: = MARCH 10, 2013;

    Now I have to choose all dates between 01-mar-2013 and 2013-mar-10 '. How to do?

    As'salamualikum Gul

    Try this

    SELECT TO_DATE('01-MAR-2013', 'DD-MON-RRRR') - 1 + rownum AS d
    FROM ALL_OBJECTS
    WHERE TO_DATE('01-MAR-2013', 'DD-MON-RRRR') - 1 + rownum BETWEEN TO_DATE('01-MAR-2013', 'DD-MON-RRRR') AND TO_DATE('10-MAR-2013', 'DD-MON-RRRR')
    

    Hope this helps

  • Make a group without selection of all paths

    I'm working on a script that will take each pathItem in a document and put it in a group (all pathItems in the document are groupless opening, so there won't be other groups already in the document).

    I have a script that creates a group, and then puts the highest pathItem placed in the group. I just can't figure out how to retrieve all the pathitems in the document, or the same action in a loop until everything is in a single group. The kicker is, as the title suggests this script should work without selecting anything first hand (in other words, after click on an item to select). Now, if there was a way to select all elements with a script that would be great.

    Here's what I have so far:

    #target Illustrator
    //based on script from Carlos Canto
    var doc = app.activeDocument
    
    if ( app.documents.length > 0 ) {
    doc = app.activeDocument;
    newGroupItem = doc.activeLayer.groupItems.add();
    }
    
    var gi = doc.groupItems[0]; // the topmost existing group
    var all = doc.pathItems[0]; // all paths in document
    
    all.move (gi, ElementPlacement.PLACEATBEGINNING); // move selected path inside the group
    all.evenodd = true; // necessary to determine "insideness" or to make holes.
    
    

    I also have what I found here on the forum

    #target Illustrator
    // GroupFromSel.jsx
    // regards pixxxelschubser 
    if ( app.documents.length > 0 && app.activeDocument.selection.length > 0) {
        var aDoc = app.activeDocument;
        var Sel = aDoc.selection;
        var GroupFromSel = aDoc.groupItems.add();
        for ( i = Sel.length-1; i >= 0; i--) {
            Sel[i].moveToBeginning( GroupFromSel )
            }
    }
    
    

    But alas, you select so two scripts, two solutions possible. I'm just working on both until I can get one to work.

    Any ideas?

    var all = doc.pathItems[0]; // all paths in document

    It's only the highest pathItem, that to change

    var all = doc.pathItems; // all paths in document
    

    .. .and loop thru 'all' and move each within your group

    #target Illustrator
    //based on script from Carlos Canto
    
    if ( app.documents.length > 0 ) {
        doc = app.activeDocument;
        var gi = doc.activeLayer.groupItems.add();
        var all = doc.pathItems; // all paths in document
    
        for (i=0; i
    

    for this configuration, we will run trouble if you have other groups with pathItems

  • How to return all dates between two dates?

    Hi all

    I need get all dates between two dates, Oracle SQL and PL/SQL.

    for example
    01/10/2011 - date 1
    10/11/2011 - date 2
    
    # Return Values
    01/10/2011
    10/02/2011
    03/10/2011
    .
    .
    .
    09/11/2011
    10/11/2011
    How can I get these values? Any help will be useful.

    Thank you

    Maybe

    select :start_date + level - 1 the_date
      from dual
    connect by level <= :end_date - :start_date + 1
    

    Concerning

    Etbin

  • How to hide all paths without widening the palette?

    It is something that I have wondered about for years:

    You know how you can deselect one way 'sex' (for lack of better word) in the palette drawn by clicking in the empty space of the paths palette? What happens if your pallet traced has saved paths as long as there is no space empty to click in? I know that I can just to expand the palette, but I don't want to have to do that, because all my palettes are solidly organized in a giant wall o ' pallets on a second monitor. Is there a way to hide all paths without having to expand the palette to bring up the empty space?

    If it is not currently using a tool running on trails, activate one, for example, press a key. Now, press ESC to untarget all paths.

  • It is possible to select a segment of a path between two points outside their clipping mask?

    I have a way with 3D rotation effect tends in a clipping mask. In the Preview mode (Ctrl + Y), most of the road is not the clipping mask, but most of the visible inside the mask in normal view because of the 3D effect turns. I want to select and remove a segment of the path between two points outside the clipping path, but Illustrator does not select the components of access outside their clipping mask path.

    Anyway is to do without for as much free mask?

    ALWAYS indicate the version you are using. Regulars here using one of the six different versions of Illustrator. Assuming that the current version:

    White pointer: marquee select around a portion of the original route which is located in the clipping mask.

    OR

    Black hand: select the object. Make a right click the object. Select isolate selected in the popup clipping mask.

    JET

  • XPath to capture nodes between two nodes

    Hi all

    I met a problem a seemingly simple challenge of mine.

    I have the following xml code.

    Basically, I would like to capture the text between the begin-end blocks

    <? XML version = "1.0" encoding = "UTF-8"? >

    < document >

    < body >

    < paragraph >

    < run >

    < fld type = 'start' / >

    < / run >

    < run >

    < text > SAMPLE < / text >

    < / run >

    < run >

    < text > < / text >

    < / run >

    < run >

    < text > FIELD < / text >

    < / run >

    < run >

    < fld type = 'end' / >

    < / run >

    < run >

    < text > TEXT UNWANTED SOME < / text >

    < / run >

    < / paragraph >

    < paragraph >

    < run >

    < fld type = 'start' / >

    < / run >

    < run >

    < text > SAMPLE < / text >

    < / run >

    < run >

    < text > < / text >

    < / run >

    < run >

    < text > Field2 < / text >

    < / run >

    < run >

    < fld type = 'end' / >

    < / run >

    < run >

    < text > TEXT UNWANTED SOME < / text >

    < / run >

    < run >

    < fld type = 'start' / >

    < / run >

    < run >

    < text > SAMPLE < / text >

    < / run >

    < run >

    < text > < / text >

    < / run >

    < run >

    < text > FIELD3 < / text >

    < / run >

    < run >

    < fld type = 'end' / >

    < / run >

    < / paragraph >

    < / body >

    < / document >

    So far, what I came up with is:

    WITH temp AS (
    SELECT 
           XMLTYPE ('<?xml version="1.0" encoding="UTF-8"?>
                      <document>
                         <body>
                            <paragraph>
                               <run>
                                  <fld type="begin" />
                               </run>
                               <run>
                                  <text>SAMPLE</text>
                               </run>
                               <run>
                                  <text> </text>
                               </run>
                               <run>
                                  <text>FIELD</text>
                               </run>
                               <run>
                                  <fld type="end" />
                               </run>
                               <run>
                                  <text>SOME UNWANTED TEXT</text>
                               </run>
                            </paragraph>
                            <paragraph>
                               <run>
                                  <fld type="begin" />
                               </run>
                               <run>
                                  <text>SAMPLE</text>
                               </run>
                               <run>
                                  <text> </text>
                               </run>
                               <run>
                                  <text>FIELD2</text>
                               </run>
                               <run>
                                  <fld type="end" />
                               </run>
                               <run>
                                  <text>SOME UNWANTED TEXT</text>
                               </run>
                               <run>
                                  <fld type="begin" />
                               </run>
                               <run>
                                  <text>SAMPLE</text>
                               </run>
                               <run>
                                  <text> </text>
                               </run>
                               <run>
                                  <text>FIELD3</text>
                               </run>
                               <run>
                                  <fld type="end" />
                               </run>
                            </paragraph>
                         </body>
                      </document>') AS xml_template
    FROM dual
    )
    SELECT x.*
      FROM temp
          ,XMLTABLE('//*/paragraph/run[fld/@type="begin"]/following-sibling::run[following-sibling::run[fld/@type="end"]]/text'
                    PASSING temp.xml_template
                    COLUMNS res varchar2(100) PATH '.'
                   )x
    

    Result:

    RES

    SAMPLE

    FIELD

    SAMPLE

    FIELD2

    SOME UNWANTED TEXT

    SAMPLE

    FIELD3

    Unfortunately what I wrote XPath is not good enough, because with regard to the text between the two blocs of start-end it still captures the unwanted text.

    My XPath knowledgege dept unfortunately not so I would appriciate annything you can help me with even an idea could get through on the edge.

    Thank you

    Steve

    Steve,

    XQuery can help in this case:

    SELECT x.*
    FROM temp
       , XMLTABLE('for $begin in /document/body/paragraph/run[fld/@type="begin"]
                   let $end := $begin/following-sibling::run[fld/@type="end"][1]
                   return $begin/following-sibling::run[. << $end]'
           PASSING temp.xml_template
           COLUMNS res varchar2(100) PATH 'text'
         ) x  ;
    

    Explanation:

    This FLWOR expression traverses all nodes 'start' in the document, finds the corresponding node of the 'end' and returns the sequence of "run" nodes follows 'begin' and above 'end '.

    If you want to concatenate all the fragments of text in a block, you can also do it directly, like this:

    for $begin in /document/body/paragraph/run[fld/@type="begin"]
    let $end := $begin/following-sibling::run[fld/@type="end"][1]
    return string-join($begin/following-sibling::run[. << $end]/text, "")
    

    She's going back 3 ranks:

    RES

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

    EXAMPLE OF A FIELD

    SAMPLE FIELD2

    SAMPLE FIELD3

Maybe you are looking for

  • Sync pictures libraries

    Somehow, on my iMac, I "managed" to get two libraries of Photos (Photos Library.photoslibrary and Photos library 2.photoslibrary). Photo library has 7426 photos and 53 videos as pictures library 2 7425 photos and 53 videos. As long as they are essent

  • Problems of bad video driver Y470P for Windows RDP

    Hello world I'm having a problem with the video driver ATI/Intel when remoting into my home computer. I use the windows remote RDP Protocol on my work computer and whenever I try to use java or flash, I get an error causing the my browser (this happe

  • Applications do not install it on El Capitan

    I recently managed to get rid of my old iMac to a new, but I had one of the problems is to install apps. specifically, Google Chrome and Sketch Up. Download completed successfully, but when I see the sign that says to put the new program in the Appli

  • The keys F (help)

    I have a G6 pavilion. The problem is when I click on the F11 key to mute volume it's my full-screen browser. To make it full screen before, I have to press and hold. Same goes for look back in minecraft where I would have to hold SHIFT + F5 to look b

  • Photo of blackBerry Smartphones

    I just got my 9350 and it says sound savings photos I take, but they are not on the device or media card.  How to recover?