Error  ORA-01436: CONNECT BY loop in user data

Y is it failing , when the query with test data is working fine. Added the output of individual queries from data base.
some times parent_order and order can be same.
SELECT *
  FROM (SELECT     *
              FROM r_brj_linkage
        START WITH order_id = 'IQBGSR20'
        CONNECT BY PRIOR parent_downstream_orderid = order_id)
WHERE alternate_linkage_rule_flag = 'N'
SELECT parent_downstream_orderid, order_id, alternate_linkage_rule_flag
  FROM r_brj_linkage
WHERE order_id = 'IQBGSR20';
output
U206650.3     IQBGSR20   Y
SELECT parent_downstream_orderid, order_id, alternate_linkage_rule_flag
  FROM r_brj_linkage
WHERE order_id = 'U206650.3';
U206650.3      U206650.3  Ni tried it with an example , and its giving me the correct results
SELECT *
  FROM (WITH t AS
             (SELECT 'XXX' parent_1, 'YYY' child_1, 'Y' flag
                FROM DUAL
              UNION ALL
              SELECT 'XYZ' AS parent_1, 'XXX' AS child_1, 'Y' AS flag
                FROM DUAL
              UNION ALL
              SELECT 'ZZZ' AS parent_1, 'XYZ' AS child_1, 'Y' AS flag
                FROM DUAL
              UNION ALL
              SELECT 'ABC' AS parent_1, 'ZZZ' AS child_1, 'N' AS flag
                FROM DUAL)
        SELECT     *
              FROM t
        START WITH child_1 = 'ZZZ'
        CONNECT BY PRIOR parent_1 = child_1)
WHERE flag = 'N';Edited by: devarade on Jan 21, 2010 2:56 PM
Edited by: devarade on Jan 21, 2010 3:06 PM

i posted the output from individual select queries. its like the last record is reporting to itself. 'ZZZ' is reporting to 'ZZZ'
this is the replecated data, when i use nocycle it is returning no data
SELECT *
  FROM (WITH t AS
             (SELECT 'XXX' parent_1, 'YYY' child_1, 'Y' flag
                FROM DUAL
              UNION ALL
              SELECT 'XYZ' AS parent_1, 'XXX' AS child_1, 'Y' AS flag
                FROM DUAL
              UNION ALL
              SELECT 'ZZZ' AS parent_1, 'XYZ' AS child_1, 'Y' AS flag
                FROM DUAL
              UNION ALL
              SELECT 'ZZZ' AS parent_1, 'ZZZ' AS child_1, 'N' AS flag
                FROM DUAL)
        SELECT     *
              FROM t
        START WITH child_1 = 'YYY'
        CONNECT BY NOCYCLE PRIOR parent_1 = child_1)
WHERE flag = 'N';Edited by: devarade on Jan 21, 2010 3:30 PM
Edited by: devarade on Jan 21, 2010 3:30 PM

Similar Messages

  • 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

  • Hi,getting an error-ORA-01436: CONNECT BY loop in user data

    hi,i am getting an error while running the select query
    SELECT callreleasetime,calleventduration
    FROM temp_med_partial_records_0001
    CONNECT BY PRIOR callreleasetime=callreleasetime
    AND PRIOR IMSI=IMSI
    AND PRIOR connectedcallingnumber=connectedcallingnumber
    Edited by: user8731258 on Feb 8, 2011 2:34 AM

    example:
    drop table test;
    create table test(no number, IMSP number,  IMSC number,  data varchar2(10));
    insert into test values(1,1,2,'a');
    insert into test values(1,2,3,'a');
    insert into test values(1,2,4,'a');
    insert into test values(1,3,5,'b');
    insert into test values(1,4,5,'b');
    insert into test values(2,1,2,'c');
    insert into test values(2,2,3,'c');
    insert into test values(4,1,2,'d');
    insert into test values(4,2,3,'d');
    insert into test values(5,1,2,'e');
    insert into test values(5,2,3,'e');
    insert into test values(5,2,3,'e');
    insert into test values(6,1,2,'f');
    commit;
    SELECT *
    FROM test
    CONNECT BY PRIOR no=no
    AND PRIOR IMSP=IMSC
    AND PRIOR data=data;
    NO                     IMSP                   IMSC                   DATA      
    1                      1                      2                      a         
    1                      2                      3                      a         
    1                      1                      2                      a         
    1                      2                      4                      a         
    1                      1                      2                      a         
    1                      3                      5                      b         
    1                      4                      5                      b         
    2                      1                      2                      c         
    2                      2                      3                      c         
    2                      1                      2                      c         
    4                      1                      2                      d         
    4                      2                      3                      d         
    4                      1                      2                      d         
    5                      1                      2                      e         
    5                      2                      3                      e         
    5                      1                      2                      e         
    5                      2                      3                      e         
    5                      1                      2                      e         
    6                      1                      2                      f   Your case
    SELECT *
    FROM test
    CONNECT BY PRIOR no=no
    AND PRIOR IMSP=IMSP
    AND PRIOR data=data;
    ORA-01436:

  • 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

  • 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

  • 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.

  • 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.

  • ORA-01436: CONNECT BY loop in user data OBIEE

    Datatemplate errors out with this..
    <dataTemplate name="ROWSET" defaultPackage="" > <properties>
    <property name="include_parameters" value="true"/>
    <property name="include_null_Element" value="true"/>
    <property name="include_rowsettag" value="false"/>
    <property name="scalable_mode" value="on"/>
    <property name="db_fetch_size" value="3000"/>
    </properties> <parameters/>
    <lexicals/>
    <dataQuery>
    <sqlStatement name="MONTHS" dataSourceRef="">
    <![CDATA[
    select level from dual connect by level <= 3
    ]]></sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="MONTHS" source="MONTHS" groupFilter="">
    <element name="level" value="level" function=""/>
    </group>
    </dataStructure>
    </dataTemplate>

    Ooops, its working, when i changed my datasource,
    Should be something wrong with the datasource,
    But the ora error mis-leaded me ;)

  • How Can I to prevent == ORA-01436: CONNECT BY loop in user data

    Hi
    In query below
    WITH TT AS (SELECT '2' PAI, '3' FILHO FROM DUAL
                UNION ALL
                SELECT '3', '5'  FROM DUAL
                UNION ALL
                SELECT '3' ,'6' FROM DUAL
                union all
                select '3','4' from dual
                union all
                select '2' , '4' from dual
                union all
                select '2', '7' from dual
                union all
                select '4','8' from dual
                union all
                select '4', '9' from dual
                union all
                select '4', '10' from dual
                union all
                select '8','11' from dual
                union all
                select '8', '12' from dual
                union all
                select '11', '15' from dual
                union all
                select '8', '16' from dual
               union all
               select '9', '3' from dual)
       select distinct  pai, filho, level
       FROM TT   
       start with pai = &x        
       connect by prior filho = pai
       order by level  desc How can I to prevent error when user type the number 3 ?
    Message was edited by:
    muttleychess

    Hi , Tks
    work Fine
    WITH TT AS (SELECT '2' PAI, '3' FILHO FROM DUAL
                UNION ALL
                SELECT '3', '5'  FROM DUAL
                UNION ALL
                SELECT '3' ,'6' FROM DUAL
                union all
                select '3','4' from dual
                union all
                select '2' , '4' from dual
                union all
                select '2', '7' from dual
                union all
                select '4','8' from dual
                union all
                select '4', '9' from dual
                union all
                select '4', '10' from dual
                union all
                select '8','11' from dual
                union all
                select '8', '12' from dual
                union all
                select '11', '15' from dual
                union all
                select '8', '16' from dual
               union all
               select '9', '3' from dual
                union all
               select '11', '2' from dual
                union all
               select '11', '19' from dual
                union all
               select '19', '17' from dual
                union all
               select '17', '9' from dual)
       select distinct  pai, filho, level
       FROM TT   
       start with pai = &x        
       connect by prior filho = pai
       and mytree.connect_by_path(level,to_char(pai))||'/' not like '%'||to_char(prior pai)||'/%'
      order by 1,3But how can put in Order where show me all path , after other : Example begin with level 1 --> go to level 2 --> level 3....etc, after go other level 1, level 2 ...etc

  • Looking at dependencies for a table gets Error ORA-01436: CONNECT BY loop

    I have just tried looking at the dependencies for a table and I received an "ORA-01436: CONNECT BY loop in user data.
    Please let me know if there are any fixes or work arounds for this problem.
    Thanks
    Sunil

    Looks like there is another posting on this.
    ORA-01436 in Dependencies
    Because the query uses CONNECT BY and there is a circular reference it errors out. If it didn't, there would be an infinite number of results.
    This is the query that Oracle is using: SELECT owner, object_type, object_name, object_id, status , decode(replace(object_type,' ','_'),'PACKAGE_BODY','PACKAGE',replace(object_type,' ','_')) type_link
      FROM sys.all_objects
      WHERE object_id IN (
              SELECT object_id
                 FROM public_dependency
               CONNECT BY PRIOR object_id = referenced_object_id
               START WITH referenced_object_id = :OBJECT_ID ) pulled from sql_dev_root/jdev/extensions/oracle.dbdev.oviewer.jar, editors.xml
    I am not a connect by pro, so I can't tell you how to alter this to make it stop digging when it encounters an infinite loop, but maybe someone else can. In other tools, it normally dynamically pulls this data into a tree so it is only querying one level at a time.
    This happens if for example MY_TABLE depends upon MY_PACKAGE and vice versa:
    --MY_TABLE
      --MY_PACKAGE
        --MY_TABLE
          --MY_PACKAGE
            .... Hopefully someone on the sql dev team has a solution to this and can get it fixed in a later release.

  • Oracle SSHR (Absence Management) Error - ORA-01436: CONNECT BY LOOP

    The following error message is displayed in Absence Review Page while creating a Leave of Absence for some employees, while working propoerly (withpout any error) for other employees,
    "An Invalid Setup has been detected for the current Transaction Type in Approvals Management. Please contact your System Administrator."
    Please note that I checked the Supervisory chain through the follwoing query and it shows data properly without any endless loop,
    SELECT levels, ppf.full_name, ppf.Employee_number
    FROM per_all_people_f ppf,
    (SELECT level levels, paf.person_id
    FROM per_all_assignments_f paf START WITH paf.person_id = &person_id
    AND paf.primary_flag = 'Y'
    AND SYSDATE BETWEEN paf.effective_start_date
    AND paf.effective_end_date CONNECT BY PRIOR paf.supervisor_id = paf.person_id
    AND paf.primary_flag = 'Y'
    AND SYSDATE BETWEEN paf.effective_start_date
    AND paf.effective_end_date ORDER BY LEVEL) paf
    WHERE ppf.person_id = paf.person_id
    AND SYSDATE BETWEEN ppf.effective_start_date
    AND ppf.effective_end_date
    ORDER BY levels
    further it may please be noted that we have currently set a singly level for approval (testing purposes).
    Any help to resolve this issue shall be highly appriciable.
    Regards,
    Nahidullah Khan

    Please also see the following docs.
    Invalid Setup Has Been Detected For The Current Transaction Type In Approvals Management [ID 1313961.1]
    An Invalid Setup has been detected for the current Transaction Type in Approvals Management. [ID 602920.1]
    An Invalid Setup Has Been Detected For The Current Transaction Type In Approvals Management. ORA-06502: PL/SQL: numeric or value error: Character string buffer too small [ID 1458422.1
    An Invalid setup has been detected for the current transaction type [ID 1300417.1]
    Connect By Loop Problem in Supervisor Hierarchy [ID 579750.1]
    Initiating A Transaction That Goes For Approval Fails With ORA-06502 [ID 795063.1]
    Thanks,
    Hussein

  • Cost Managment - CSTPPACQ.acq_cost_processor(30):ORA-01436: CONNECT BY loop

    Hi,
    We have run the program Periodic Aquisition Cost but it error out. the Error is
    CSTPPACQ.acq_cost_processor(30):ORA-01436: CONNECT BY loop in user data.
    Plz guide me.

    Hello,
    For this error, I think you should open an SR. It looks like patch 5378145 that is references in Metalink note 405966.1.
    It could be useful to run the Cost manager in Trace mode, in order to get the statement that fails.

  • 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>

  • 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.

Maybe you are looking for

  • Duplicate invoice check ( MIRO)

    Hi All I have done all the settings for duplicate invoice check. And I posted an invoice with the following parameters on a limit PO Company code:ABC Document date:12.09.2009 Reference:INV1 Currency:USD Vendor:102221 Amount:20 Now I am trying to post

  • IPhone thinks Bluetooth is still active

    My wife and I have identical iPhone 4s' with iOS 5.1, but... She has her iPhone paired to the bluetooth in a Subaru Forester and the connection is fine, mp3s play thru the speakers, etc...the problem is that when she turns off the vehicle and goes in

  • Need help for networking

    Hi, I want to know where can i get help (functions or interfaces) to interact with IP layer in solaris such as (registering a protocol or sending or receiving messages to/from ip etc). thankx & Regards, Prasenjit

  • How to clear cookies for a single domain?

    The new Developer Tools on IE 11 is terrible. Previously, we can clear session cookies for the current page or clear cookies for the whole domain (of the current page).  My page is now showing www.facebook.com and I am logged in to Facebook.  I click

  • VA02 Ship To address change

    Hello All, Is it possible to change the ship to address from VA02: assuming delivery/billing is not done yet? If so, how? Regards. Edited by: Rags on Jan 21, 2009 11:00 AM