Recursive unconsciousness - 11.2.0.1

I'm trying to get more familiar with (among others) the recursive with clause which is available since 11.2.
As a test case, I currently use the datadictionary and a parent-child scenario.
My goal is to get the same results as the 'classic' be connect by returns.
Here are the DDL:
/*
drop table t7 purge;
drop table t6 purge;
drop table t5 purge;
drop table t4 purge;
drop table t3 purge;
drop table t2 purge;
drop table t1 purge;
*/
create table t1 ( col1 int primary key, col2 int );
create table t2 ( col1 int primary key, col2 int references t1(col1) );
create table t3 ( col1 int primary key, col2 int references t2(col1) );
create table t4 ( col1 int , col2 int references t3(col1) );
create table t5 ( col1 int primary key, col2 int references t1(col1) );
create table t6 ( col1 int primary key, col2 int references t2(col1) );
create table t7 ( col1 int primary key, col2 int references t1(col1) );
/*
insert into t1
select level c1
,      level*10 c2
from   dual connect by level <= 100000;
insert into t2 select col2, col1 from t1;
insert into t3 select col2, col1 from t2;
insert into t4 select col2, col1 from t3;
insert into t5 select col2, col1 from t1;
insert into t6 select col2, col1 from t2;
insert into t7 select col2, col1 from t1;
*/
Note a caveat: it ' s a picture without a PK, but with a FK.
Also note that there are no other tables in the schema that I have tested in.

Using a CONNECTION, I am able to get all of the tree:
SQL> with the_constraints as (select p.table_name
  2                           ,      p.constraint_name
  3                           ,      p.constraint_type relation
  4                           ,      p.r_constraint_name
  5                           from   user_constraints p
  6                           where ( p.constraint_type = 'P'
  7                                  or
  8                                   not exists ( select null
  9                                                from   user_constraints c
 10                                                where  c.table_name = p.table_name
 11                                                and    c.constraint_type = 'P'
 12                                              )
 13                                 )
 14                           union all
 15                           select a.table_name
 16                           ,      a.constraint_name 
 17                           ,      b.constraint_type
 18                           ,      b.r_constraint_name
 19                           from   user_constraints a
 20                           ,      user_constraints b
 21                           where a.table_name = b.table_name
 22                           and   a.constraint_type = 'P'
 23                           and   b.constraint_type = 'R'
 24                          )
 25  select rownum seq
 26  ,      lpad('*', (level*2-1), '*')||table_name lvl
 27  ,      table_name
 28  ,      constraint_name
 29  ,      relation
 30  ,      r_constraint_name
 31  from   the_constraints
 32  start with table_name = 'T1'
 33  connect by constraint_name <> r_constraint_name 
 34         and  prior constraint_name = r_constraint_name
 35  order siblings by table_name;

       SEQ LVL        TABLE_NAME                     CONSTRAINT_NAME                R R_CONSTRAINT_NAME
---------- ---------- ------------------------------ ------------------------------ - --------------
         1 *T1        T1                             SYS_C0016484                   P
         2 ***T2      T2                             SYS_C0016485                   R SYS_C0016484
         3 *****T3    T3                             SYS_C0016487                   R SYS_C0016485
         4 *******T4  T4                             SYS_C0016489                   R SYS_C0016487
         5 *****T6    T6                             SYS_C0016492                   R SYS_C0016485
         6 ***T5      T5                             SYS_C0016490                   R SYS_C0016484
         7 ***T7      T7                             SYS_C0016494                   R SYS_C0016484

7 rows selected.
What I got sofar using the recursive, after playing and 'punished' by several new error messages, is the following:
I commented out the bad things, but left intentionally, so that you know that you don't have to try again
SQL> with the_constraints (table_name, constraint_name, r_constraint_name)  
  2  as ( select a.table_name
  3       ,      a.constraint_name 
  4       ,      b.r_constraint_name
  5       from   user_constraints a
  6       ,      user_constraints b
  7       where a.table_name = b.table_name
  8       and   a.constraint_type = 'P' 
  9       and   b.constraint_type = 'R' 
 10       union all
 11       select w.table_name
 12       ,      w.constraint_name
 13       ,      w.r_constraint_name
 14       from   the_constraints w
 15      /* ,      user_constraints p   
 16       where ( p.table_name = w.table_name
 17         or
 18          not exists ( select null
 19                       from   user_constraints c
 20                       where  c.table_name = p.table_name
 21                       and    c.constraint_type = 'P'
 22                     )
 23             )*/
 24          )
 25  search depth first by table_name set seq
 26  cycle table_name set is_cycle to 1 default 0
 27  select seq
 28  --,      is_cycle
 29  ,      table_name
 30  ,      constraint_name
 31  ,      r_constraint_name
 32  from   the_constraints;

       SEQ TABLE_NAME                     CONSTRAINT_NAME                R_CONSTRAINT_NAME
---------- ------------------------------ ------------------------------ ---------------------------
         1 T2                             SYS_C0016485                   SYS_C0016484
         2 T2                             SYS_C0016485                   SYS_C0016484
         3 T3                             SYS_C0016487                   SYS_C0016485
         4 T3                             SYS_C0016487                   SYS_C0016485
         5 T5                             SYS_C0016490                   SYS_C0016484
         6 T5                             SYS_C0016490                   SYS_C0016484
         7 T6                             SYS_C0016492                   SYS_C0016485
         8 T6                             SYS_C0016492                   SYS_C0016485
         9 T7                             SYS_C0016494                   SYS_C0016484
        10 T7                             SYS_C0016494                   SYS_C0016484

10 rows selected.

SQL> /*
SQL> ORA-32044: cycle detected while executing recursive WITH query
SQL>     Cause: A recursive WITH clause query produced a cycle and was stopped in order to avoid an 
infinite loop.
SQL>     Action: Rewrite the recursive WITH query to stop the recursion or use the CYCLE clause.
SQL> */
What I'm missing is how to get to T1, at the root, little matter what I tried, T1 never appeared in my result set, even when I let out as a predicate as my last request... shows once again I feel I'm pretty close...
Thanks (again) for the pointers!

Okay, last attempt for today ;-), it's night now...

with the_constraints (table_name, constraint_name, r_constraint_name)
as (
select a.table_name
,      a.constraint_name
,      a.r_constraint_name
from   user_constraints a
where table_name like 'T1'
union all
select b.table_name
,      nvl((select constraint_name from user_constraints where table_name=b.table_name and constraint_type = 'P'),b.constraint_name)
,      b.r_constraint_name
from   the_constraints w,
       user_constraints b
where
       w.constraint_name=b.r_constraint_name
       and
       constraint_type = 'R'
)
search depth first by table_name set seq
cycle table_name set is_cycle to 1 default 0

select
*
from
the_constraints

TABLE_NAME     CONSTRAINT_NAME     R_CONSTRAINT_NAME     SEQ     IS_CYCLE
T1     SYS_C0017760896     -      1     0
T2     SYS_C0017760897     SYS_C0017760896     2     0
T3     SYS_C0017760899     SYS_C0017760897     3     0
T4     SYS_C0017760901     SYS_C0017760899     4     0
T6     SYS_C0017760904     SYS_C0017760897     5     0
T5     SYS_C0017760902     SYS_C0017760896     6     0
T7     SYS_C0017760906     SYS_C0017760896     7     0

A few words about this:

We intuitionnel to start with T1, because it's the root table.
The first attempt should have worked in the case references are always built by r_constraint_name directly.
But there is an indirection, go 'R' type interim constraint to the constraint type 'P '.

Published by: chris227 on 16.04.2013 13:55

Tags: Database

Similar Questions

  • I get script error java application "too much recursion" and they come in 4. This happened after the upgrade to firefox

    Hello

    I've recently upgraded to firefox 35, after this upgrade, whenever I log on tumblr, I get this "java script application error too much recursion" and they come in 4 (I have to click on each one on top of the other). I am able to connect and do my normal stuff, but whenever I move to another page inside of tumblr, the same java script error appears and I have to click again to make them disappear.
    This seems to happen only on this website (tumblr).

    any help will be appreciated.
    Thank you

    for anyone else having this problem... Fixed it got...
    Xensemble app for tumblrto tumblr users, if the application that is causing the prob ' java script application error too much recursion ".
    Xensemble has finally solved the extension of the application and all what you need to do is to download the fixed xensemble extension on their site.

    Thank you

  • Best folder to start the recursive backup of?

    Recently had difficulty to recover my Thunderbird and Lightning files after an accident in Ubuntu 14.04. Is .thunderbird the best place to start a recursive backup?

    I would say that Yes, but it depends where. Thunderbird is. Try the info below to be sure.

    Click on the Help menu, then the troubleshooting information. Click the Open button to the profile folder.

    This location or the one above him is a good starting point for a backup.

  • Is it possible to create a recursive cluster?

    I am creating a clusterA with several numeric fields and string , BUT I need to include an array of variables clusterA. Is it still possible?

    Is this possible with OO in LabVIEW86?

    Thank you!

    <-N->>

    The direct answer to both questions is no. LV allows no recursive data types.

    That does not mean, however, that you cannot do entirely. You can do this, but you lose a type safety:

    • With LVOOP, you create a table of LV object (or another class that inherits from A of). You can now push your class in the table and pull it out. You can use dynamic distribution to exploit or more class specific to make a cast of the elements you get out at runtime for the correct class and then do what you need.

    • With a normal cluster, you should be able to do something similar by making the type of data in the table a Variant or a string and then flatten your clusters before pushing them into the table. This will require probably more memory allocations, and you're probably better to go the LVOOP route.

  • recursive average online, flattening

    I implement an online estimate of statistics (average, kurtosis) using FPGA and CRIO NI 9234 recursively. I'm data streams using a FPGA.  I want to calculate statistics using data continuously in real time.  I am new to the FPGA and Labview. Can you please help how can I implement the same. Shift register I think but it will take only a few data points.

    Thank you

    Prakash guru

    FPGA programming is very different from programming in LabVIEW, but if you're a new user the best place to start is to read the following tutorials:

    Getting Started With LabVIEW FPGA

    http://www.NI.com/Tutorial/14532/en/

    LabVIEW FPGA on-line tutorial

    http://www.NI.com/SWF/presentation/us/LabVIEW/lvfpga/default.htm

    To be completely honest, I suggest you consider signing upward for some classes online, including:

    LabVIEW CORE 1 and 2

    LabVIEW time real 1

    LabVIEW FPGA

  • model of recursive list of files

    Hello

    I created a Subvi, which runs a main folder for specific files and adds them to a compressed folder. I have 4 files that I create for different types of collected files (.csv and .txt). The file naming convention include an object identifier, description of the task and time (most of the time). Here are some examples:

    ABC_30s_narrow_ec_12-23-42 - PM_R.csv (multiple with different timestamps)

    ABC_30s_narrow_ec_12-23-42 - PM_L.csv (multiple with different timestamps)

    ABC_sts_arms_12-21-06 - PM.csv (multiple with different timestamps)

    ABC_Tablet_2_12-26-56 - PM.txt (multiple with different timestamps)

    ABC_gait.txt

    ABC_zero.csv

    I tried by using the model of the vi recursive list of files to search for a specific task (for example 30 sec) and that move to a compressed folder you specified (for example the balance). Files are moved only if the "model" at the end of the file name. The model is only the end of the files listed or can I get it to find the model in the middle of the name? And is it possible to find two patterns (for example, 30 s and zero) and move them to the same folder, without crushing the compressed file? I would like to understand this without modifying the convention of naming too much (predetermined by someone else).

    Thanks in advance,

    Anton

    The model can be applied anywhere in the file name. Aid indicates specifically how a boss can ask at the beginning of a file name (*.vi matches all the screws). To search for specific text in the middle of the file name, you must use a model like * text * (with an asterisk before and after the text that you want to match). You can similarly to mutiple models with * pattern1 * pattern2 *.

  • list by program dependencies recursively to a VI (subVIs)

    In a large application that I'm developing, I use VI server calls to load the screws in memory. However, I recently met a problem that is causing a bit of a headache. I was able to load and run, using the VI server, a series of screws (which are a bit like plugins). In other words, all but one. This curious VI charges, gets inserted into a secondary façade, but seems that the executing State = bad. According to aid, this means the VI is broken and does not work.

    Now, my framework of support ensures that the missing dependencies are requested when a VI using calls to the server, IE if a dependency cannot be found through dialogue through familiar loading appears, indeed in the course of development I've seen this happen several times. So I know that this last VI is not without other dependencies because it do not ask me to point to one, and I know that the VI should work because it opens and runs fine when running in the development environment.

    So what I think I do, it's programmatically determine which VI (subVIs) dependencies are at fault. I've not done this before so I don't know where to start, I guess that the script will be necessary, but:

    Is there an easy way to enumerate dependencies recursively to a VI (subVIs) programmatically?

    With such a list, I should be able to examine each for the one (s) that is broken and get to the bottom of this mystery. I hope that there are new codes provided with LabVIEW I can use for this.

    Any help most appreciated!

    The easy way to do this is use the VI get the dependencies of VI.  It has an option to return the entire tree, so you don't have recursion by iterating through the entire thing.  However, this method is relatively new.  It replaces the former called property, which must be used recursively.

  • List of files of recursive VI

    Let me start by saying that I have little experience with Labview. It is limited to change the programs that I use for my research that were written by others. I'm looking to automate processing of data generated by a colleague VI. Currently, using the VI, he invited me to the file to process, treatment, then invites me to enter a filename under which results are saved. However, I have about 700 files requiring treaties and would like to have run himself.

    I'm hoping to change the file so that, instead of asking me a single file, it asks me for a file, then treats all of the files it finds inside this folder. I tell myself that the recursive file list VI is a good choice, because it returns the filepaths of anything in the folder in a table (if I understood), but I don't know how to do to have the VI deal with these in turn.

    BASICALLY, I need a way to select a folder and have LabView feed individual files in a treatment of already existing data VI (the insertion point is a function of "open a file"). Can I use the recursive file list VI for that? If so, how I treat the files individually. If this is not the case, what should I use?

    Thank you much for the help.

    Yes, you can certainly use the Recursive file list VI. The entrance to this VI is the root folder that contains your files to process, and you can also plug in a 'model' for example *.txt to get filtered output (consult the detailed help for the VI section). The output of this VI is a list of paths. This list of wire with a loop For, and inside the loop, you will have a sequential access to every element in the list. Inside the loop, thread the path to the treatment algorithm you. To automatically save data with an auto-generated file name, take the path going, try parse, modify the string with the string concatenation function, go up the path and then use it to write a new file.

  • Variable performance on a recursive query/view/CTE SQL - server 2008 R2

    I ask for help on the following problem.

    We use a view with a recursive select in it (see below). On a specific server (Server A) the performance of this view varies a lot. Respons times differ between 100 ms and 30 seconds or even more. We tested the same point of view on a backup of the database on another server (Server B) which results in a stable and good performance. A backup of the database that is installed on a server with no other interaction even results in variable performance. We compared the settings of operating system and the database on server A and Server B. There is no difference.

    We need additional input to resolve this problem. So please help!

    Concerning

    Announcement

    Create view [dbo]. [vwMarketSegmentsAll] as

    WITH MarketSegmentsAll (MSID, MSVersion, MSName, MarketSegmentFK, SegmentCategoryFK, RegionFK, country code, CountryFK, GlobalSegmentFK, MSLevel, MSCode, FirstActiveYear, LastActiveYear, Label, RootMarketSegmentFK, CropSegmentFK, CropFK) AS
    (
    -Definition of anchor member
    SELECT ms.ID, Mrs. Version ms. name, Mrs. MarketSegmentFK, Mrs. SegmentCategoryFK, Mrs. RegionFK, r.CountryCode, r.ID as CountryFK, Mrs. GlobalSegmentFK, 1, MSCode = CAST (ms. GlobalSegmentFK as nvarchar (50)), Mrs. FirstActiveYear, Mrs. LastActiveYear, gs. Label, ms.ID, gs. CropSegmentFK, gs. CropFK
    MarketSegment AS ms
    Join region r on r.id = ms. RegionFK
    Join GlobalSegment GS on gs.id = MS GlobalSegmentFK.
    If not of ms. GlobalSegmentFK is null
    UNION ALL
    -Recursive member definition
    SELECT ms.ID, Mrs. Version ms. name, Mrs. MarketSegmentFK, Mrs. SegmentCategoryFK, Mrs. RegionFK, msc. CountryCode, msc. CountryFK, msc. GlobalSegmentFK, msc. MSLevel + 1, CAST (MSCode + case when Ms..) SegmentCategoryFK is null then "another '-' + CAST (ms. SegmentCategoryFK as nvarchar (3)) end as nvarchar (50)), Mrs. FirstActiveYear, Mrs. LastActiveYear, msc. Label, msc. RootMarketSegmentFK, msc. CropSegmentFK, msc. CropFK
    MarketSegment AS ms
    JOIN MarketSegmentsAll AS msc ON msc. MSID = MarketSegmentFK Ms.
    where Mrs. GlobalSegmentFK is null
    )
    -The statement that executes the CTE
    Select msA.MSLevel,
    msA.MSVersion,
    msA.MSCode,
    msA.MSName,
    msA.MSID,
    msA.MarketSegmentFK,
    msA.SegmentCategoryFK,
    msA.GlobalSegmentFK,
    msA.RegionFK,
    msA.CountryCode,
    msA.CountryFK,
    msA.FirstActiveYear,
    msA.LastActiveYear,
    msA.Label,
    RootMarketSegmentFK =
    CASE
    WHEN msA.MSLevel > 1 THEN msA.RootMarketSegmentFK
    ELSE null
    END,
    MSA. CropSegmentFK,
    MSA. CropFK

    OF MarketSegmentsAll msA

    GO

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
    *
  • HP 15A 103tx: deleted unconsciously thermal paste from surface of cpu and gpu.

    Hello
    Last Sunday I accidentally poured alcohol on my laptop I went and cleaned my laptop. While cleaning I have unconsciously remove thermal paste from surface of cpu and gpu and now my laptop shows lines and points as a TV screen when it is a bad sign. I went to a local store of den the guys checked my laptop and the screen is fine, but something's wrong with the video card. I googled and just to know that I removed the thermal paste that must have been stuck back after cleaning.
    Please help what should I do now?
    After starting the laptop starts "auto den, but nothing happens then."
    Help, please.

    The guarantee has disappeared while they charge you for it and fat. Of course, you know how to get there because you did once before.

    Use things like:

    http://www.Amazon.com/Arctic-Silver-high-density-polysynthetic-compound/DP/B000OGX5AM/ref=sr_1_1?ie=UTF8&QID=1454709376&SR=8-1&keywords=Arctic+Silver

    Apply it on the heart of processor and the flat surface of any piece that comes in contact with a metal part of the radiator, not the parts affecting flexible. Apply a point the size of a BB in a gun to air. You can send it with a spatula as thin as possible plastic until it covers. A little goes a long way, as long as get you coverage.

    If it's 'the Answer' please click on 'Accept as Solution' to help others find it.

  • Defined print recursively all the

    Hello, I got a review of C++ that I did well except the last problem.

    the last problem

    I m, n and whole sum positive. In this issue, we are interested in arrays of length n whose entries are included in the integers {1,2,..., m} such that the sum of the enteries of the array is less than or equal to the sum.

    Write a recursive function that given m, n and sum, prints all of these paintings. Your function must also calculate the total number N of these arrys.

    Examples:

    For m = 3, n = 3 and the sum = 4, the print function

    1-1-1

    1 2 1

    2-1-1

    so N = 4

    For m = 3, n = 3 and the sum = 5, the printing function

    1-1-1

    1 1 2

    1 1 3

    1 2 1

    1-2-2

    1-3-1

    2-1-1

    2 1 2

    2 2 1

    3-1-1

    so N = 10

    Form = 3, n = 4 and sum = 6, the print function

    1 1 1 1

    1 1 1 2

    1 1 1 3

    1 1 2 1

    1 1 2 2

    1 1 3 1

    1 2 1 1

    1 2 1 2

    1 2 2 1

    1 3 1 1

    2 1 1 1

    2 1 2 1

    2 2 1 1

    3 1 1 1

    so N = 15

    The time of your function must be of the order of the size of output N (and no m to the nth power). In other words, you are epected to avoid recursive branches that do not lead eventually to the valid berries.

    "

    Which way is the best way to solve this problem, I used a loop for and place inside the same recursive function. What type of setting should I have I used (I used a pointer to a table, int, int, itn)

    I didn't know the reference scenario, so I put when I happens final times.

    Any body wants the solution, designed to

  • 1.0.4.11 WebWorks directory creation recursive. Bug in build tools

    When packing a webworks app so that it can be deployed on a device, after the creation of a signature of dev & loading on the device, I followed the instructions here:

    https://developer.BlackBerry.com/HTML5/documentation/package_your_bb10_app_with_ww_sdk_2008473_11.ht...

    In particular, I came to the next line on the site:

    bbwp C:\myapp -o C:\myapp\output
    

    As I am on windows 8 and did not an archive .zip. This line of the example, you will notice that the output directory in the source directory of the application. I followed the same pattern, which seems reasonable... provide package manager doesn't contract not all ridiculous bugs.

    To my surprise the conditioner has created a so deep that windows cannot remove (src/release/src/outputs...) recursively. Packager has literally damaged my hard drive. Trying to evaluate this issue & isolate the problem (as long as the output is also, it seems to work very well) I've now littered with my hard drive with these directories.

    From a virtual machine with shared directory:

    http://www.Flickr.com/photos/38998737@N06/9339871997/

    James

    Kudos to MrNorris for help to drive the changes here:

    https://developer.BlackBerry.com/HTML5/documentation/package_your_bb10_app_with_ww_sdk_2008473_11.ht...

    Documentation has been updated as well as a small note do not use a subfolder of the project folder. You probably saved many developers of the future some grief :-)

  • unconsciously I blocked the memory card from my camera with BitLocker. How I unlock my card.

    in fact when I use my computer, unconsciously I clicked on BitLocker and my memory card is locked. After that I've faced some strange problems, even if my card is 4 GB and free space is 3.18 GB; While it shows that the memory card is full. Please tell me how could I unlock my card?

    Hello

     
    What is the brand and model of the memory card?
     
    I suggest you to refer to the links and check if it helps.
    In Windows 7 BitLocker Drive Encryption: frequently asked Questions
     
    How to use the BitLocker Repair tool to help recover data from a volume encrypted in Windows Vista or in Windows Server 2008
    Note: Also applies to Windows 7.
     
    See also:
    BitLocker Drive Encryption

    If the problem persists, try to disable and re-enable Bitlocker.
    Steps to follow:

    (a) click Start and then click Control Panel.

    (b) click on security.
    (c) click BitLocker Drive encryption.
    (d) if the user account control dialog box appears, check the action proposed is correct and then click on continue.
    (e) click on disable BitLocker.
    (f) click on disable BitLocker.
    (g) in the window of the BitLocker Drive encryption, click on turn on BitLocker.
    (h) close to the BitLocker Drive encryption.
     
    Hope this solves the problem. If the problem persists, you can write to us and we will be happy to help you further.
  • Convert connected by recursive with clause

    Dear Experts,

    I'm using Oracle 12.1.02.

    Suite SQL returns all the date between the start_dt and end_dt provided.  How can I change this SQL in the WITH recursive clause

    WITH parms
         AS (SELECT   to_date('07/01/2015 00:00:00','MM/DD/YYYY HH24:MI:SS') start_dt, to_date('07/31/2015 23:59:59','MM/DD/YYYY HH24:MI:SS') end_dt
                    FROM   DUAL)
          SELECT       CAST (start_dt AS DATE) + (LEVEL - 1) ts_day
                   FROM   parms
             CONNECT BY   LEVEL <= TRUNC ( (CAST (end_dt AS DATE) - CAST (start_dt AS DATE)) + 1)
    

    Thank you.

    Hello

    Here's one way:

    WITH dates_wanted (ts_day) AS

    (

    SELECT TO_DATE (1 July 2015 ', "DD/MM/YYYY")- or what date you want start

    OF the double

    UNION ALL

    SELECT ts_day + 1

    OF dates_wanted

    WHERE ts_day< to_date="" ('07/31/2015',="" 'dd/mm/yyyy') ="" --="" or="" whatever="" end="" date="" you="">

    )

    SELECT *.

    OF dates_wanted

    ORDER BY ts_day

    ;

    In fact, I get an error when I do this in Oracle 11.2.0.2.0, but I think it's just a bug.  I don't have another version around that time.

    PS: as Andrew pointed out in response #4, below, "DD/MM" above should be "MM/DD".  My mistake.

    PPS: It works in Oracle 12.1.0.1.0 (and "MM/DD/YYYY", of course).

  • Recursive relationship in oracle

    I have a table that stores customer, the related client and the number of connected clients.

    The related client may have even more related customers that it is like a recursive relationship.

    I wanted to know all the clients connected (until the last customer related) for a client.

    I had tried something like below who gave me an error loop in the user data

    Select *.

    of (connect_by_root (cus_id) select cus_id, rel_cus_id)

    of RELATED_TABLE

    Start with rel_cus_id is not null

    Connect prior cus_id = rel_cus_id)

    where cus_id <>rel_cus_id;

    Statistics on the table:--

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

    This volume is 2,00,000 records.

    Create table

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

    CREATE TABLE RELATED_TABLE

    (CUS_ID, VARCHAR2 (09))

    REL_CUS_ID VARCHAR2 (09),.

    COUNT_OF_REL_CUST NUMBER (12));

    Samples: -.

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

    INSERT INTO RELATED_TABLE VALUES ('402758970', '898196448', 3);

    INSERT INTO RELATED_TABLE VALUES ('402758970', '855115206', 3);

    INSERT INTO RELATED_TABLE VALUES ('402758970', '850353774', 3);

    INSERT INTO RELATED_TABLE VALUES ('898196448', '691094946', 3);

    INSERT INTO RELATED_TABLE VALUES ('898196448', '404636299', 3);

    INSERT INTO RELATED_TABLE VALUES ('898196448', '402758970', 3);

    INSERT INTO RELATED_TABLE VALUES ('855115206', '870397045', 3);

    INSERT INTO RELATED_TABLE VALUES ('855115206', '855115206', 3);

    INSERT INTO RELATED_TABLE VALUES ('855115206', '402758970', 3);

    CUS_ID REL_CUS_ID COUNT_OF_REL_CUST

    402758970 898196448 3

    402758970 855115206 3

    402758970 850353774 3

    898196448 691094946 3

    898196448 404636299 3

    898196448 402758970 3

    855115206 870397045 3

    855115206 855115206 3

    855115206 402758970 3

    OUTPUT:-

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

    402758970 898196448

    402758970 855115206

    402758970 850353774

    402758970 691094946

    402758970 404636299

    402758970 870397045

    402758970 855115206

    We know not what you need, but it looks like:

    SQL > SELECT DISTINCT CUS_ID '402758970',

    2 REL_CUS_ID

    RELATED_TABLE 3

    4. START WITH CUS_ID = '402758970'

    5. CONNECT NOCYCLE PRIOR REL_CUS_ID = CUS_ID

    6.

    CUS_ID REL_CUS_I

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

    402758970 898196448

    402758970 691094946

    402758970 870397045

    402758970 402758970

    402758970 404636299

    402758970 850353774

    402758970 855115206

    7 selected lines.

    SQL >

    SY.

Maybe you are looking for

  • The worst ever updated Community Discussion

    Nothing makes more difficult to answer a question. Apple seems to plunge quickly its lowest common denominator. (which is surprisingly low)

  • Limit the bandwidth Time Capsule

    I am about to install a new Capsule 3 TB but am simultaneously looking for a solution of throttling split a WIFI network guests & owner. There are only 70 GB p/month available (satellite 2way) and currently you can empty just this pipe in a few weeks

  • Firefox keeps telling me to update, even though I know that I've updated.

    On aid, when it checks updates told me that I am on the last, but everywhere elsewhere (for example Devientart or Mozilla Startpage) it tells me I need to update. I'm sure that I've updated, and I can't access certain pages without being on the lates

  • laptop does not recognize the memory card

    ORIGINAL TITLE: Olympus FE - 310 digital camera I put my memory card in my laptop but the laptop is not picking up any ideas?

  • How to set my documents to stay in alphabetical order

    original title; How can I get this stupid thing to leave things alone and let my documents in alphabetical order The documents in my folder are now back in is A. How to make come back in alphabetical order which is more precisely, this is why change