CONNECT BY loop in user data - how to stop on loop?

Hey,
I have a table EXAMPL_TAB with two columns PART_1 and PART_2.
looks like:
PART_1  |  PART_2
    z1  |      z2
    z2  |      z3
    z3  |      z4
    z3  |      z2    <-- LOOP  -- don't wanna loop again
    z3  |      z1    <-- LOOP  -- don't wanna loop again
    z4  |      z5I wolud get sth with SYS_CONNECT_BY_PATH(PART_1, '/') like:
/z1
/z1/z2/
/z1/z2/z3/
/z1/z2/z3/z4
/z1/z2/z3/z4/z5or better
/z1
/z1/z2/
/z1/z2/z3/
/z1/z2/z3/z2  <-- and stop
/z1/z2/z3/z1  <-- and stop
/z1/z2/z3/z4
/z1/z2/z3/z4/z5Please, somebody help me.

like
SQL> with t as (
  2  select 'z1' c1,'z2' c2 from dual union all
  3  select 'z2' c1,'z3' c2 from dual union all
  4  select 'z3' c1,'z4' c2 from dual union all
  5  select 'z3' c1,'z2' c2 from dual union all
  6  select 'z3' c1,'z1' c2 from dual union all
  7  select 'z4' c1,'z5' c2 from dual  )
  8  select c1,c2,level
  9  from t
10  start with c1 = 'z1'
11  connect by nocycle prior c2 = c1;
C1 C2      LEVEL
z1 z2          1
z2 z3          2
z3 z4          3
z4 z5          4
z3 z1          3

Similar Messages

  • Connect by loop in user data: urgent solution needed

    Hai iam using oracle9i and my problem is
    in my client place we r developing a report
    of bill_of_materials and it seems the data
    is having some recursive nature.
    iam getting connect by loop in user data: how to avoid it in oracle9i.
    i have two tables prm010ebomh1 and prm010ebomh2.
    now 1st table consists of the product and 2nd table consists of the components
    forming the product.
    a good solution is welcomed.
    My query is:
    SELECT DISTINCT B.SL_NO,A.FITEM_CD,B.SITEM_CD,
    LPAD(C.ITEM_DESC,LENGTH(C.ITEM_DESC)+(LEVEL*2)-2,' ') AssyLevel,
    b.qty
    from prm010ebomh a, prm010ebomd b,m032item c
    where a.fitem_cd=b.fitem_cd
    and a.type=b.type
    and a.comp_cd=b.comp_cd
    and a.comp_cdch=b.comp_cdch
    and a.comp_cd='IFA'
    AND A.COMP_CDCH='D01'
    START WITH A.FITEM_CD='A0150100'
    CONNECT BY A.FITEM_CD=PRIOR B.SITEM_CD
    ORDER SIBLINGS BY B.SL_NO.

    Modify the data so that the circular references are avoided.
    ORA-01436 CONNECT BY loop in user data
    Cause: The condition specified in a CONNECT BY clause caused a loop in the query, where the next record to be selected is a descendent of itself. When this happens, there can be no end to the query.
    Action: Check the CONNECT BY clause and remove the circular reference.

  • How to bypass "ORA-01436: CONNECT BY loop in user data" ?

    Hello everybody
    I have a problem with a ORA-01436 firing too early on a query I'm trying to execute.
    There is a table of strings. Each string on that table should be composed of a single character or it must be obtained by the concatenation of a single character on another string in the table.
    Sometime this requirement is missing. I can't do anything to drive the table to be in that way. So I would like to execute a query witch corrects that table by adding the missing strings in it. When there are some strings that can't be obtained by appending a single char from another string the the query should list also the missing chain of strings to make that string valid in the table.
    An example.
    create table strings (
         val varchar2(10) not null
    insert into strings (val) values ('A')
    insert into strings (val) values ('ABCDE')
    insert into strings (val) values ('AD')
    insert into strings (val) values ('ADF')
    select *
    from strings
    order by val
    Query finished, retrieving results...
        VAL   
    A         
    ABCDE     
    AD        
    ADF       
    4 row(s) retrievedAs you can see the bold string ABCDE is not valid because it can't be obtained by
    appending a single char to any other string in the table.
    In this case a valid result should also list the chain of strings 'AB', 'ABC' and 'ABCD'.
    To find the strings where a chain of missing strings begins and finishes I use this query.
    Processing ...
    select val,p_val
    from (
         select val,lag(val) over (order by val) as p_val
         from strings
    ) a
    WHERE val not like p_val||'_' and val like p_val||'%' AND p_val IS NOT NULL
    Query finished, retrieving results...
        VAL       P_VAL  
    ABCDE      A         
    1 row(s) retrievedIn this simple case a can list the missing strings with this query.
    Processing ...
    select val,p_val,p_val||SUBSTR(val,LENGTH(p_val)+1,LEVEL) as chain_string,LEVEL
    FROM (
    select val,p_val
    from (
         select val,lag(val) over (order by val) as p_val
         from strings
    ) a
    WHERE val not like p_val||'_' and val like p_val||'%' AND p_val IS NOT NULL
    CONNECT BY LENGTH(val)>LENGTH(p_val)+LEVEL
    Query finished, retrieving results...
        VAL       P_VAL       CHAIN_STRING                      LEVEL                
    ABCDE      A          AB                                                        1
    ABCDE      A          ABC                                                       2
    ABCDE      A          ABCD                                                      3
    3 row(s) retrievedBut when I have more than one string to be validated things change and the hierarchical query is not good any more in this way.
    insert into strings (val) values ('ADFGH')
    Processing ...
    select *
    from strings
    order by val
    Query finished, retrieving results...
        VAL   
    A         
    ABCDE     
    AD        
    ADF       
    ADFGH     
    5 row(s) retrievedBecause I retrieve solutions regarding the one string mixed with all the others
    Processing ...
    select val,p_val,p_val||SUBSTR(val,LENGTH(p_val)+1,LEVEL) as chain_string,LEVEL
    FROM (
    select val,p_val
    from (
         select val,lag(val) over (order by val) as p_val
         from strings
    ) a
    WHERE val not like p_val||'_' and val like p_val||'%' AND p_val IS NOT NULL
    CONNECT BY LENGTH(val)>LENGTH(p_val)+LEVEL
    Query finished, retrieving results...
        VAL       P_VAL       CHAIN_STRING                      LEVEL                
    ABCDE      A          AB                                                        1
    ABCDE      A          ABC                                                       2
    ABCDE      A          ABCD                                                      3
    ADFGH      ADF        ADFG                                                      1
    ABCDE A ABC 2
    ABCDE A ABCD 3
    6 row(s) retrievedTo avoid this I should add a condition to link val to prior val in the connect by clause but here it throws ORA-01436.
    Processing ...
    select val,p_val,p_val||SUBSTR(val,LENGTH(p_val)+1,LEVEL) as chain_string,LEVEL
    FROM (
    select val,p_val
    from (
         select val,lag(val) over (order by val) as p_val
         from strings
    ) a
    WHERE val not like p_val||'_' and val like p_val||'%' AND p_val IS NOT NULL
    CONNECT BY LENGTH(val)>LENGTH(p_val)+LEVEL AND val = PRIOR val
    select val,p_val,p_val||SUBSTR(val,LENGTH(p_val)+1,LEVEL) as chain_string,LEVEL
    ORA-01436: CONNECT BY loop in user dataWhat could I do to bypass that check?
    I know I could query for distinct values on the first query (the one without the condition val = PRIOR val ) but I'd like to know if you had similar problems and how did you solved them in this case.
    Thanks
    Bye Alessandro

    I don't know why but with 10.2.0.4 Oracle now found a way to raise this error again.
    Connected to:                                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production          
    With the Partitioning, Real Application Clusters, OLAP, Data Mining                   
    and Real Application Testing options                                                  
    SQL> create table strings (                                                        
      2     val varchar2(10) not null                                                     
      3  )                                                                                
      4  /                                                                                
    Table created.                                                                        
    SQL>                                                                               
    SQL> insert into strings (val) values ('A')                                        
      2  /                                                                                
    1 row created.                                                                        
    SQL> insert into strings (val) values ('ABCDE')                                    
      2  /                                                                                
    1 row created.                                                                        
    SQL> insert into strings (val) values ('AD')                                       
      2  /                                                                                
    1 row created.                                                                        
    SQL> insert into strings (val) values ('ADF')                                      
      2  /                                                                                
    1 row created.                                                                        
    SQL>                                                                               
    SQL> select val,p_val,p_val||SUBSTR(val,LENGTH(p_val)+1,LEVEL) as chain_string,LEVEL
      2  FROM (select val,p_val                                                           
      3        from (                                                                     
      4              select val,lag(val) over (order by val) as p_val                     
      5              from strings) a                                                      
      6        WHERE val not like p_val||'_' and val like p_val||'%' AND p_val IS NOT NULL)
      7  CONNECT BY LENGTH(val)>LENGTH(p_val)+LEVEL  AND val = PRIOR val                  
      8  and prior dbms_random.value is not null                                          
      9  /                                                                                
    ERROR:                                                                                
    ORA-01436: CONNECT BY loop in user data                                               
    no rows selected                                                                      
    SQL>Had someone of you found a way to do it again.
    Thanks
    Bye Alessandro

  • ORA-01436 CONNECT by loop in user data Oracle HRMS - How do I prevent this?

    I am getting from time to time an error when users are performing tasks in Oracle HRMS that comes back as ORA-01436 CONNECT by loop in user data.
    This issue is caused when there exists a loop in the Supervisor hierarchy.
    For ex: Emp A reports to Emp B and Emp B reports to A
    OR
    Emp A reports to B and B reports to C and C reports to A.
    It can be any of the above or if there are more approvers then there can be a
    bigger loop.
    This is described on Oracle Metalink Doc ID: 275819.1
    This happens to us regularly; someone puts the manager of an employee as the subordinate of the 1st employee - of course this is not logically possible!
    My question is how do i prevent this in the HRMS Manager tool or the Self Service functionality - I want the user to be informed and prevented from creating these infinite loops in the first place ...any ideas?

    Hi,
    We suffer same the kind of issue but as you might have seen there is no immediate answer from Oracle about implementing a check within the Application forms/SS. In the end we wrote a report to hunt to locate loops in employee supervisor chain and report any circular references it finds. This report is scheduled to run every day and the customer reviews the output and then fixes the loops. Not ideal but we've not had chance to investigate a custom trigger say on the per_all_assignments_f table.

  • Error : CONNECT BY loop in user data

    Getting CONNECT BY loop in user data:
    Table X  (sample data actually have 35K rows)
    CODE             CASE              OLD_ID                NEW_ID            PERSON       AUTH
    01              ab122         1234               0001             AU123     99393
    07              vv353          7872               0919             FV982     78282
    01              ab122         1982               9929             AU123     99393
    04               hjsss         8839                8302            JK920     32320
    01              ab122         0001               1982             AU123     99393
    05              cg899         6728               32322           IKL020     65252
    07              w353          0919                8282             FV982     78282
    now I need to order this data comparing row values of old_id to new_id for each of the combinations of code, person, case
    need output like below
    Table X
    CODE             CASE              OLD_ID                NEW_ID            PERSON       AUTH
    01              ab122         1234               0001             AU123     99393
    01              ab122         0001               1982             AU123     99393
    01              ab122         1982               9929             AU123     99393
    04               hjsss         8839                8302            JK920     32320
    05              cg899         6728              32322           IKL020     65252
    07              vv353          7872               0919             FV982     78282
    07              w353          0919                8282            FV982     78282
    to get this I am using:
    --Query--
    select * from table_x
    start with old_id not in(
                                      select new_id
                                      from table_x
    CONNECT BY old_id = PRIOR new_id
           AND   code   = PRIOR code
           AND   case   = PRIOR case
           AND   person = PRIOR person
    --Query--
    runs fine with sample data but the problem is when excute it with actual table that has 35K records..
    Cause: The condition specified in a CONNECT BY clause caused a loop in the query, where the next record to be selected is a descendent of itself. When this happens, there can be no end to the query.
    Action: Check the CONNECT BY clause and remove the circular reference.
    Thanks,
    AK

    Hi,
    CONNECT_BY_ISCYCLE is a pseudo-column that you can use in a CONNECT BY NOCYCLE query.  It's separate from the CONNECT BY clause.
    Try this:
    select  code, "CASE", person
    ,       SYS_CONNECT_BY_PATH (old_id, '/') AS path
    from    table_x
    where   CONNECT_BY_ISCYCLE = 1
    start with  old_id not in (
                                      select new_id
                                      from table_x
    CONNECT BY NOCYCLE old_id = PRIOR new_id
            AND        code   = PRIOR code
            AND        "CASE" = PRIOR "CASE"
            AND        person = PRIOR person
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002

  • Need help in resolving CONNECT BY loop in user data in Oracle 9.2.0.5 Ver

    Hi Everyone,
    Below are the scripts to reproduce the error
    CREATE TABLE TESTING
    C1 NUMBER,
    C2 NUMBER,
    GRP NUMBER
    Insert into TESTING
    (C1, C2, GRP)
    Values
    (1, 2, 100);
    Insert into TESTING
    (C1, C2, GRP)
    Values
    (1, 3, 100);
    Insert into TESTING
    (C1, C2, GRP)
    Values
    (2, 5, 200);
    Insert into TESTING
    (C1, C2, GRP)
    Values
    (3, 11, 200);
    Insert into TESTING
    (C1, C2, GRP)
    Values
    (11, 1, 400);
    COMMIT;
    SELECT sys_connect_by_path(C1,'/') AS C1,C2
    FROM TESTING
    CONNECT BY C1 = PRIOR C2
    I am getting "ORA-01436: CONNECT BY loop in user data" because of Recurssion.
    My Oracle Version is 9.2.0.5, can you guide me how to resolve in 9.2.0.5
    In Oracle 10g I have read that we can achieve through NOCYCLE option
    Can you please guide me how to solve this in Oracle 9.2.0.5 Version
    Thanks in Advance,
    Sankar

    SQL> SELECT     SYS_CONNECT_BY_PATH (c1, '/') AS c1, c2
      2        FROM testing
      3  CONNECT BY  c1 = PRIOR c2 AND (c2 >= PRIOR c1);
    C1                                                         C2
    /1                                                          2
    /1/2                                                        5
    /1                                                          3
    /1/3                                                       11
    /2                                                          5
    /3                                                         11
    /11                                                         1
    7 ligne(s) sélectionnée(s).
    SQL>

  • Getting "CONNECT BY loop in user data" error

    Hi all,
    I used to run the following query but I got this error "CONNECT BY loop in user data"
    select * from
    bom_details
    where common_bill_sequence_id=bill_sequence_id
    connect by prior assembly_item_id=component_item_id
    Bom_details is one view which contains
    SELECT distinct bi1.assembly_item_id, bic.bill_sequence_id, bi1.organization_id,
    bi1.common_bill_sequence_id, bic.component_item_id,
    bic.component_quantity, bic.item_num
    FROM bom_bill_of_materials bi1, bom_inventory_components bic
    where bi1.bill_sequence_id = bic.bill_sequence_id
    Please advice how to use the query.
    Thanks,
    Kamal

    Hi,
    You could try using the NOCYCLE directive to avoid user data errors e.g.
    select * from
    bom_details
    where common_bill_sequence_id=bill_sequence_id
    connect by NOCYCLE prior assembly_item_id=component_item_id
    Rod West

  • CONNECT BY loop in user data

    Hi everbody,
    Please a need some help with this:
    I'm learning about how to generate rows in oracle from the page.
    http://blog.lishman.com/2008/02/how-to-generate-rows-in-oracle_2477.html
    In that page there is an example like this:
    SELECT rownum
    FROM dual
    CONNECT BY LEVEL <= 5;
    I execute this sentence in my oracle 8i database but a get this message: CONNECT BY loop in user data
    Please,where is the problem?
    Thanks in advance

    user491853 wrote:
    Thank you justin !
    I need to execute this query, because I need to find what 'TUESDAYS' are between 2 dates:
    SELECT t.dt, TRIM (TO_CHAR (t.dt, 'DAY')) "DAY"
    FROM (SELECT TRUNC (SYSDATE) + ROWNUM dt
    FROM DUAL
    CONNECT BY LEVEL <= 80) t
    WHERE TRIM (TO_CHAR (t.dt, 'DAY')) = 'THURSDAY'
    AND t.dt BETWEEN TO_DATE ('01/08/2006', 'dd/mm/rrrr')
    AND TO_DATE ('31/08/2006', 'dd/mm/rrrr')
    The result would be:
    DT DAY
    03-AUG-06 THURSDAY
    10-AUG-06 THURSDAY
    17-AUG-06 THURSDAY
    24-AUG-06 THURSDAY
    31-AUG-06 THURSDAY
    How can I execute a similar query in oracle 8i? Thanks buddy for any response.I can't test it as I don't have access to 8i but does following query work (to generate rows)?
    SELECT  level
    FROM DUAL
    CONNECT BY LEVEL <= 80
    AND PRIOR dbms_random.random IS NOT NULL ;

  • Error: ORA-01436: CONNECT BY loop in user data.... with EnableVersioning

    Hi everyone,
    i'm having some troubles when i execute DBMS_WM.EnableVersioning() procedure for all of the tables from my database.
    This is the sql line....
    EXEC DBMS_WM.EnableVersioning('SAN.SAN_AMPLIAC_ANULAC, SAN.SAN_ANALISISCALIDAD, SAN.SAN_ANALISISCALIDAD_LTS, SAN.SAN_ANALISISCALITEM, SAN.SAN_ANALISISCAMARA, SAN.SAN_APLICACION, SAN.SAN_APLICACION_ORDEN, SAN.SAN_APLI_ORD_ITEM', 'VIEW_WO_OVERWRITE');
    And the error is:
    ORA-01436: CONNECT BY loop in user data
    ORA-06512: at "SYS.LTDDL", line 1464
    ORA-06512: at "SYS.LTDDL", line 1289
    ORA-06512: at "SYS.LT", line 796
    ORA-06512: at "SYS.LT", line 8374
    ORA-06512: at line 2
    If somebody knows how to fix it, please let me know.
    Thanks in advance,
    Jime.

    Hello Ben!
    Thanks for answer me. I need to fix this as soon as possible.
    Thank you.
    Jime
    [email protected]
    Here are the answers to your questions:
    1. i'm using Oracle 9i
    2.
    NAME VALUE
    ALLOW_CAPTURE_EVENTS OFF
    ALLOW_MULTI_PARENT_WORKSPACES OFF
    ALLOW_NESTED_TABLE_COLUMNS OFF
    CR_WORKSPACE_MODE OPTIMISTIC_LOCKING
    FIRE_TRIGGERS_FOR_NONDML_EVENTS ON
    NONCR_WORKSPACE_MODE OPTIMISTIC_LOCKING
    OWM_VERSION 9.2.0.2.0
    USE_TIMESTAMP_TYPE_FOR_HISTORY ON
    3.
    OWNER CONSTRAINT_NAME CONSTRAINT_TYPE TABLE_NAME SEARCH_CONDITION R_OWNER R_CONSTRAINT_NAME DELETE_RULE STATUS DEFERRABLE DEFERRED VALIDATED GENERATED BAD RELY LAST_CHANGE INDEX_OWNER INDEX_NAME INVALID VIEW_RELATED
    SAN FK_ANALISISCALIDAD_1 R SAN_ANALISISCALIDAD SAN PK_SAN_GRADO CASCADE ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:15:11 PM
    SAN FK_ANALISISCALITEM_1 R SAN_ANALISISCALITEM SAN PK_SAN_RUBRO CASCADE DISABLED NOT DEFERRABLE IMMEDIATE NOT VALIDATED USER NAME 9/22/2003 1:15:16 PM
    SAN FK_ANALISISCALITEM_2 R SAN_ANALISISCALITEM SAN PK_ID_SERVICIO CASCADE ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:15:16 PM
    SAN FK_ANALISISCALITEM_3 R SAN_ANALISISCALITEM SAN PK_ANALISISCALIDAD CASCADE ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:22:39 PM
    SAN FK_ANALISISCAMARA_1 R SAN_ANALISISCAMARA SAN PK_SAN_CLIENTE_PARTE_ROL CASCADE ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:15:14 PM
    SAN FK_ANALISISCAMARA_2 R SAN_ANALISISCAMARA SAN PK_ANALISISCAMARA CASCADE ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:22:21 PM
    SAN FK_ANALISISCAMARA_3 R SAN_ANALISISCAMARA SAN PK_ANALISISCALIDAD CASCADE ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:22:21 PM
    SAN FK_SAN_APLICACION_ORDEN R SAN_APLI_ORD_ITEM SAN PK_SAN_APLICACION_ORDEN NO ACTION ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 6/19/2003 5:34:46 PM
    SAN FK_SAN_ORDEN_ITEMS R SAN_APLI_ORD_ITEM SAN PK_SAN_ORDEN_ITEMS NO ACTION ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 6/19/2003 5:34:48 PM
    SAN PK_ANALISISCALIDAD P SAN_ANALISISCALIDAD ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:15:11 PM PK_ANALISISCALIDAD
    SAN PK_ANALISISCALITEM P SAN_ANALISISCALITEM ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:15:16 PM PK_ANALISISCALITEM
    SAN PK_ANALISISCAMARA P SAN_ANALISISCAMARA ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 9/22/2003 1:15:13 PM PK_ANALISISCAMARA
    SAN PK_APLIC_ORDEN_ITEM P SAN_APLI_ORD_ITEM ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 6/19/2003 5:34:11 PM PK_APLIC_ORDEN_ITEM
    SAN PK_SAN_APLICACION_ORDEN P SAN_APLICACION_ORDEN ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME 6/19/2003 5:34:20 PM PK_SAN_APLICACION_ORDEN
    SAN SYS_C0019582 C SAN_APLICACION_ORDEN "DENOMINACION" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:08:54 PM
    SAN SYS_C0019586 C SAN_APLI_ORD_ITEM "ORDEN" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:08:55 PM
    SAN SYS_C0019587 C SAN_APLI_ORD_ITEM "CONDICION" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:08:55 PM
    SAN SYS_C0020519 C SAN_APLICACION_ORDEN "ID_APLICACION_ORDEN" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:31:45 PM
    SAN SYS_C0020520 C SAN_APLI_ORD_ITEM "ID_APLICACION_ORDEN" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:31:45 PM
    SAN SYS_C0020521 C SAN_APLI_ORD_ITEM "ID_APLI_ORD_ITEM" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:31:45 PM
    SAN SYS_C0020522 C SAN_APLI_ORD_ITEM "ID_ITEM" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 6/19/2003 5:31:45 PM
    SAN SYS_C0021509 C SAN_ANALISISCALIDAD "ID_ANALISISCALIDAD" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 8/11/2003 6:42:52 PM
    SAN SYS_C0021512 C SAN_ANALISISCALITEM "ID_ANALISISCALITEM" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 8/11/2003 6:42:52 PM
    SAN SYS_C0021790 C SAN_ANALISISCAMARA "ID_ANALISISCALIDAD" IS NOT NULL ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 9/3/2003 1:09:39 PM
    4.
    OWNER CONSTRAINT_NAME TABLE_NAME COLUMN_NAME POSITION
    SAN FK_ANALISISCALIDAD_1 SAN_ANALISISCALIDAD ID_GRADO 1
    SAN FK_ANALISISCALITEM_1 SAN_ANALISISCALITEM ID_RUBRO 1
    SAN FK_ANALISISCALITEM_2 SAN_ANALISISCALITEM ID_SERVICIO 1
    SAN FK_ANALISISCALITEM_3 SAN_ANALISISCALITEM ID_ANALISISCALIDAD 1
    SAN FK_ANALISISCAMARA_1 SAN_ANALISISCAMARA ID_CLIENTEPARTEROL 1
    SAN FK_ANALISISCAMARA_2 SAN_ANALISISCAMARA ID_ANALISISCALIDAD 1
    SAN FK_ANALISISCAMARA_3 SAN_ANALISISCAMARA ID_ANALISISCALIDAD 1
    SAN FK_SAN_APLICACION_ORDEN SAN_APLI_ORD_ITEM ID_APLICACION_ORDEN 1
    SAN FK_SAN_ORDEN_ITEMS SAN_APLI_ORD_ITEM ID_ITEM 1
    SAN PK_ANALISISCALIDAD SAN_ANALISISCALIDAD ID_ANALISISCALIDAD 1
    SAN PK_ANALISISCALITEM SAN_ANALISISCALITEM ID_ANALISISCALITEM 1
    SAN PK_ANALISISCAMARA SAN_ANALISISCAMARA ID_ANALISISCALIDAD 1
    SAN PK_APLIC_ORDEN_ITEM SAN_APLI_ORD_ITEM ID_APLI_ORD_ITEM 1
    SAN PK_SAN_APLICACION_ORDEN SAN_APLICACION_ORDEN ID_APLICACION_ORDEN 1
    SAN SYS_C0019582 SAN_APLICACION_ORDEN DENOMINACION
    SAN SYS_C0019586 SAN_APLI_ORD_ITEM ORDEN
    SAN SYS_C0019587 SAN_APLI_ORD_ITEM CONDICION
    SAN SYS_C0020519 SAN_APLICACION_ORDEN ID_APLICACION_ORDEN
    SAN SYS_C0020520 SAN_APLI_ORD_ITEM ID_APLICACION_ORDEN
    SAN SYS_C0020521 SAN_APLI_ORD_ITEM ID_APLI_ORD_ITEM
    SAN SYS_C0020522 SAN_APLI_ORD_ITEM ID_ITEM
    SAN SYS_C0021509 SAN_ANALISISCALIDAD ID_ANALISISCALIDAD
    SAN SYS_C0021512 SAN_ANALISISCALITEM ID_ANALISISCALITEM
    SAN SYS_C0021790 SAN_ANALISISCAMARA ID_ANALISISCALIDAD

  • ORA-01436: CONNECT BY loop in user data, but CONNECT_BY_ISCYCLE is all ZERO

    hi,
    when I run below query, it always throws error below:
    SELECT connect_by_root code AS code_root,
        CODE,
        CODE_DESC,
        UP_CODE
      FROM DI_CODE_LEVEL
      WHERE TYPE_CODE='SP'
        CONNECT BY PRIOR CODE=UP_CODE;
    ORA-01436: CONNECT BY loop in user data
    01436. 00000 -  "CONNECT BY loop in user data"But when I use NOCLYCLE and CONNECT_BY_ISCYCLE to find out which row is in question,
    it shows nothing, which means CONNECT_BY_ISCYCLE=ZERO for all rows.
    select * from (
        SELECT connect_by_root code AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE ,
            CONNECT_BY_ISCYCLE AS ISCYCLE
          FROM DI_CODE_LEVEL
          WHERE TYPE_CODE='SP'
            CONNECT BY NOCYCLE PRIOR CODE=UP_CODE
    where ISCYCLE>0;Is there any other reason that this sql would throw ORA-01436?
    If there is a loop, then will the combination of NOCYCLE, CONNECT_BY_ISCYCLE will show?
    Thanks

    Hi,
    Apparantly, one or more of the 'SP' rows are causing the problem.
    The WHERE clause is applied after the CONNECT BY is finished, so saying:
    select * from (
        SELECT connect_by_root code AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE ,
            CONNECT_BY_ISCYCLE AS ISCYCLE
          FROM DI_CODE_LEVEL
          WHERE TYPE_CODE='SP'
            CONNECT BY NOCYCLE PRIOR CODE=UP_CODE
    where ISCYCLE>0;is equivalent to
    select * from (
        SELECT connect_by_root code AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE ,
            CONNECT_BY_ISCYCLE AS ISCYCLE
          FROM DI_CODE_LEVEL
            CONNECT BY NOCYCLE PRIOR CODE=UP_CODE
    WHERE    TYPE_CODE = 'SP'
    AND     ISCYCLE   > 0;To see where the loop occurs, you have to include the rows where type_code='SP'.
    When debugging "ORA-01436: CONNECT BY loop in user data", display SYS_CONNECT_BY_PATH (uk, ...), where uk is some unique key. That will tell you a lot more than just the root information. You might want this:
    SELECT  connect_by_root code                AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE
    ,     SYS_CONNECCT_BY_PATH (code, '/')     AS path          -- For debugging
    ,       CONNECT_BY_ISCYCLE                AS ISCYCLE     -- For debugging
    FROM      DI_CODE_LEVEL
    -- WHERE TYPE_CODE = 'SP'     -- Commented out for debugging
    where      ISCYCLE > 0          -- For debugging
    CONNECT BY NOCYCLE      PRIOR CODE = UP_CODE 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Explain how you get those results from that data.
    Always say what version of Oracle you're using.

  • DBMS_RANDOM and ORA-01436: CONNECT BY loop in user data

    Hi,
    The following query gets the error "ORA_01436: CONNECT BY loop in user data":
    SELECT     currentdate
    ,     ADD_MONTHS ( currentdate
                 , (LEVEL - 1) * months
                 ) + ((LEVEL - 1) * days)     AS final_date
    ,     level
    FROM     table_z
    WHERE     CONNECT_BY_ISLEAF = 1
    CONNECT BY     currentdate               = PRIOR currentdate
    AND          PRIOR dbms_random.value          IS NOT NULL
    AND          ADD_MONTHS ( currentdate
                         , (LEVEL - 2) * months
                         ) + ((LEVEL - 2) * days) <= TO_DATE ( '05/01/2008'
                                                                      , 'MM/DD/YYYY'
                                                  );I've seen "PRIOR dbms_random.value IS NOT NULL" used like this as as a way to get around ORA-01436 in Oracle 9, but I'm using Oracle 11, and it doesn't work
    currentdate is unique.
    If I hard-code any one set of values, like this:
    DEFINE currentdate      = "TO_DATE ('03/02/2006', 'MM/DD/YYYY')"
    DEFINE days           = 300
    DEFINE months           = 0
    SELECT     &currentdate
    ,     ADD_MONTHS ( &currentdate
                 , (LEVEL - 1) * &months
                 ) + ((LEVEL - 1) * &days)     AS final_date
    FROM     dual
    WHERE     CONNECT_BY_ISLEAF = 1
    CONNECT BY     &currentdate               = PRIOR &currentdate
    AND          PRIOR dbms_random.value          IS NOT NULL
    AND          ADD_MONTHS ( &currentdate
                         , (LEVEL - 2) * &months
                         ) + ((LEVEL - 2) * &days) <= TO_DATE ( '05/01/2008'
                                                                       , 'MM/DD/YYYY'
                                                   );I can get the correct results from dual. I was looking for a way to extend this to get multiple rows from table_z in the same query.
    The problem came up in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=894946&tstart=0], where the problem is:
    Given this table:
    CREATE TABLE     table_z
    (      currentdate     DATE
    ,      months          NUMBER
    ,      days          NUMBER
    INSERT INTO table_z (currentdate, months, days) VALUES (TO_DATE ('03/02/2006', 'MM/DD/YYYY'),     0,     300);
    INSERT INTO table_z (currentdate, months, days) VALUES (TO_DATE ('04/05/2006', 'MM/DD/YYYY'),     10,     0);
    INSERT INTO table_z (currentdate, months, days) VALUES (TO_DATE ('05/04/2006', 'MM/DD/YYYY'),     3,     0);I'm trying to add the given number of months and/or days to currentdate until I reach a given hard-coded cutoff date (05/01/2008 in this case).
    That is, the desired results from the data above are:
    CURRENTDAT     MONTHS       DAYS FINALDATE
    03/02/2006          0        300 08/18/2008
    04/05/2006         10          0 10/05/2008
    05/04/2006          3          0 05/04/2008Edited by: Frank Kulash on May 4, 2009 7:38 PM
    Typo in CONNECT BY conditions fixed.

    Hi Frank,
    Sounds like a bug. Funny enough, but this works:
    SQL> select * from v$version where rownum = 1
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    SQL> SELECT currentdate
      2  , ADD_MONTHS ( currentdate
      3       , (LEVEL - 1) * months
      4       ) + ((LEVEL - 1) * days) AS final_date
      5  , level
      6  FROM table_z
      7  WHERE CONNECT_BY_ISLEAF = 1
      8  CONNECT BY currentdate   = PRIOR currentdate
      9  AND  PRIOR dbms_random.value  IS NOT NULL
    10  AND  ADD_MONTHS ( currentdate
    11           , (LEVEL - 1) * months
    12           ) + ((LEVEL - 1) * days) <= TO_DATE ( '05/01/2008'
    13                                        , 'MM/DD/YYYY'
    14                    );
    FROM table_z
    ERROR at line 6:
    ORA-01436: CONNECT BY loop in user data
    SQL>
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT currentdate
      2  , ADD_MONTHS ( currentdate
      3       , (LEVEL - 1) * months
      4       ) + ((LEVEL - 1) * days) AS final_date
      5  , level
      6  FROM table_z
      7  WHERE CONNECT_BY_ISLEAF = 1
      8  CONNECT BY currentdate   = PRIOR currentdate + 0
      9  AND  PRIOR dbms_random.value  IS NOT NULL
    10  AND  ADD_MONTHS ( currentdate
    11           , (LEVEL - 1) * months
    12           ) + ((LEVEL - 1) * days) <= TO_DATE ( '05/01/2008'
    13                                        , 'MM/DD/YYYY'
    14*                   )
    SQL> /
    CURRENTDA FINAL_DAT      LEVEL
    02-MAR-06 23-OCT-07          3
    05-APR-06 05-DEC-07          3
    04-MAY-06 04-FEB-08          8
    SQL> SY.

  • ORA-01436: CONNECT BY loop in user data

    We are using Oracle HR Manager Self Service and using the menu option, Worker Status Change, the subject error message appears when an attempt is made to submitted for approval.
    Any suggestions as to what could be causing this?
    Thanks,
    Lee

    Please post the details of the application release, database version and OS.
    We are using Oracle HR Manager Self Service and using the menu option, Worker Status Change, the subject error message appears when an attempt is made to submitted for approval.
    Any suggestions as to what could be causing this?Please review these docs and see if it helps.
    SSHR - ORA-01436 Connect By Loop Error In User Data In Manager Self Service [ID 333630.1]
    PER_449800_ORA_1436 When Clicking On Manager Actions Links [ID 427428.1]
    Ora-01436: Connect By Loop In User Data Ora-06512: At "Apps.Hr_security_internal [ID 873617.1]
    ORA-01436: CONNECT BY LOOP in user data in SSHR [ID 275819.1]
    SSHR: ORA-01436: Connect By Loop In User Data [ID 357718.1]
    Configuring Oracle Self-Service Human Resources (SSHR) Approvals Using Approvals Management (AME) [ID 360515.1]
    Thanks,
    Hussein

  • How to stop while loop when a specified function is terminated?

    I want to make a program which has 2 thread, one of which is to control some devices, and the other is to measure outputs of the devices.
    To do that, I should make a 2 independent loops, but there comes a problem here.
    I want to terminate 2 loops at the same time, but it's difficult for me to do that, because when I try to notify upper sequence's termination to lower loop by some value change, they have some dependency.
    That's why I need your help. I want to know how to stop lower loop when the upper sequence's termination keeping their independency.
    Please let me know. Thank you.
    Attachments:
    help.JPG ‏200 KB

    Is the upper loop commanding the lower loop at all?  I would think you would have some type of communication between the loops.  Just use that communication to send a stop command.  Or the next best way is to just simply use a notifier.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to stop while loop

    I can't figure out how to stop a while loop in my labview program. 
    When the user presses the Run arrow in the toolbar I want my program to begin reading the serial port for GPS messages.  These messages should be displayed on the front panel.  Currently I have this read/display in a while loop.  The program is also waiting for an extrenal trigger.  When that trigger arrives, I want to grab the current string from the serial port and save it and continue reading and displaying the serial/gps string.  This trigger starts the other parts of the program- signal generation, recording, and saving data which need to run concurrently with the serial/gps reading/displaying.  Once the AO and AI have finished and the data have been written to disk, I want the program to stop.  The serial/gps messages should be updating this whole time.  Only when the data are written to disk should the whole program end.  This whole sequence of events should only be done once when the user preses the Run arrow. 
    So far I'm unable to pluck the serial string when the trigger comes in if I'm watching the serial port all the time.  The program also doesn't stop when it finishes writing to disk because the read serial while loop is still running.  I don't want to use a front panel stop button.  The program should stop itself when the data havebeen written. 
    I'm really stumped on this one but I'm new to LabVIEW so I'm sure there's an easy solution to this. 
    Thanks for any and all help. 
    Attachments:
    SPoleLakeChirp.vi ‏199 KB

    Dennis and altenbach-  Thank you both for your patience. 
    I was trying to do just what Dennis suggested-"As I said, setting a local variable is one way." even before posting to this forum, but I couldn't get my local variables to reflect changes made elsewhere in the program and I wasn't able to wire from them because they were writes.  The critical part I was missing was how to change a local variable from a write to a read.  It was staring me in the face the whole time- just right click.  When I finally found it, my problems were solved. 
    altenbach- thank's for putting the figures together.  I do understand the logic and wiring there, but I was really trying to avoid stop buttons.  The program should be smart enough to figure out when to stop.  And using local variables turns out to be one way of solving this.  I still have some clean up to do, but I've included my current working version just so you can see how I implimented your suggestions.  There's still a lot of clean up to be done, but I'm delighted to be able to watch the serial/gps messages until I'm done reading in data.  At first I had this stop variable set in the final sequence frame.  That didn't work because I wasn't getting to the final frame because the loop wasn't finishing.  Once I placed the stop variable in the same frame as the while loop it began stopping when it should. 
    If you have other comments/critiques about the wiring diagram I'm earger to hear them.  I'm considering the structure finished, however.  It still needs cleaning up and commenting, but I'm satisfied with the functionality. 
    Thanks,
    Peter
    Attachments:
    SPoleLakeChirp.vi ‏210 KB

Maybe you are looking for

  • Color categories for appointment in calendar

    I just got a new computer.  Was operating in Windows 7, now 8 with Microsoft Office 365.  The data, contacts and calendar was pulled over from my Outlook 2007 to the new Outlook 2013.  I love the color coded category feature I used to have. I don't h

  • Will not start only spinning wheel

    My two-year old iMac 21.5 will not start. All I get is a gray Apple Screen and the spinner.   Before this restart, I changed the permissions for the hard drive to allow the administrator to have access to the whole hard drive.  I got a start series o

  • Constants in BPEL - best practice?

    Hello, In our workflows we use a lot of constant values. Constants can be of course hardcoded to the bpel process, but it is not very nice solution for viewing or editing them later. What would be the best practice for handling constants in BPEL? Cou

  • Integrating with other view technologies

    Which of views technologies (instead JSP) I can integrate with JSF and is this very complicated? I can�t find any information about this. :( Please help me

  • ExecuteBaseLogic::Invalid object name 'tblStatus'  when submitting data

    Hi experts, I've encounter the following error while submitting data via input schedule: ExecuteBaseLogic::Invalid object name 'tblStatus' in: select distince d.CATEGORY,d.ENTITY,d.TIMEID from #RESULT_334020 d where signeddata<>0 and exists [select *