Connect By clause works on 11g but not on Oracle 8i : “ORA-01436: CONNECT BY loop in user data”Create View with 365 daysDifference between a user and a schema in Oracle?Retrieve Last days data from TIMESTAMP(6) ColumnWhat is the difference between connect by level and connect by prior in oracle?ORA-00904: ORDER BY with UNION ALLSQL: Create Trailer CountMigrating from Oracle to SQL server. Dual table select query -> SQL serverHow to determine week of a quarter in Oracle queryIssue connecting Oracle 11g to SQL Server 2012 — ORA-12523: TNS:listener could not find instance appropriate for the client connectionsql pivot function using date as a columnOracle inequality comparison - invalid number

How to get the speed of my spaceship?

Multi-user CRUD: Valid, Problem, or Error?

Alternative to Willpower in Fighting Cravings

How do resistors generate different heat if we make the current fixed and changed the voltage and resistance? Notice the flow of charge is constant

Why do Martians have to wear space helmets?

How do amateur satellites stay consistently in the amateur-sat bands acoss the globe?

Will Jimmy fall off his platform?

What are some bad ways to subvert tropes?

comparing two addresses

Examples of fluid (including air) being used to transmit digital data?

Does a Globe of Invulnerability spell block outsiders from teleporting inside with a spell?

Taking my Ph.D. advisor out for dinner after graduation

How complicated can a finite double complex over a field be?

Is this standard Japanese employment negotiations, or am I missing something?

How important is it for multiple POVs to run chronologically?

Is there a minimum amount of electricity that can be fed back into the grid?

How to play a D major chord lower than the open E major chord on guitar?

Initializing variables in an "if" statement

How did Captain Marvel do this without dying?

Attach a visible light telescope to the outside of the ISS

Is this car delivery via Ebay Motors on Craigslist a scam?

Who goes first? Person disembarking bus or the bicycle?

Can you create a free-floating MASYU puzzle?

Do intermediate subdomains need to exist?



Connect By clause works on 11g but not on Oracle 8i : “ORA-01436: CONNECT BY loop in user data”


Create View with 365 daysDifference between a user and a schema in Oracle?Retrieve Last days data from TIMESTAMP(6) ColumnWhat is the difference between connect by level and connect by prior in oracle?ORA-00904: ORDER BY with UNION ALLSQL: Create Trailer CountMigrating from Oracle to SQL server. Dual table select query -> SQL serverHow to determine week of a quarter in Oracle queryIssue connecting Oracle 11g to SQL Server 2012 — ORA-12523: TNS:listener could not find instance appropriate for the client connectionsql pivot function using date as a columnOracle inequality comparison - invalid number






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I found the code for a row generator from this question Create View with 365 days



CREATE VIEW year_days (the_day) AS
SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
FROM DUAL
CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
/
SELECT * FROM year_days


Since I don't have CREATE privileges, I modified it to an inline-query form :



SELECT
year_days.*
FROM
(
SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
FROM DUAL
CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
) year_days


The inline-query code above works perfectly fine on one of our Oracle 11g R2 (v11.2.0.3.0) instance, as well as on Oracle's own LiveSQL (19c, v19.2.0.0.0).



However, it does not work on the instance that it needs to run on, which is 8i (v8.1.7.4.0).
I get ORA-01436: CONNECT BY loop in user data.



At first glance it seems that 8i sees an infinite loop in that code, but not 11g and up. Why ?



Note: I know 8i is old. I have no control over that.










share|improve this question






























    1















    I found the code for a row generator from this question Create View with 365 days



    CREATE VIEW year_days (the_day) AS
    SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
    FROM DUAL
    CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
    /
    SELECT * FROM year_days


    Since I don't have CREATE privileges, I modified it to an inline-query form :



    SELECT
    year_days.*
    FROM
    (
    SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
    FROM DUAL
    CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
    ) year_days


    The inline-query code above works perfectly fine on one of our Oracle 11g R2 (v11.2.0.3.0) instance, as well as on Oracle's own LiveSQL (19c, v19.2.0.0.0).



    However, it does not work on the instance that it needs to run on, which is 8i (v8.1.7.4.0).
    I get ORA-01436: CONNECT BY loop in user data.



    At first glance it seems that 8i sees an infinite loop in that code, but not 11g and up. Why ?



    Note: I know 8i is old. I have no control over that.










    share|improve this question


























      1












      1








      1








      I found the code for a row generator from this question Create View with 365 days



      CREATE VIEW year_days (the_day) AS
      SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
      FROM DUAL
      CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
      /
      SELECT * FROM year_days


      Since I don't have CREATE privileges, I modified it to an inline-query form :



      SELECT
      year_days.*
      FROM
      (
      SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
      FROM DUAL
      CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
      ) year_days


      The inline-query code above works perfectly fine on one of our Oracle 11g R2 (v11.2.0.3.0) instance, as well as on Oracle's own LiveSQL (19c, v19.2.0.0.0).



      However, it does not work on the instance that it needs to run on, which is 8i (v8.1.7.4.0).
      I get ORA-01436: CONNECT BY loop in user data.



      At first glance it seems that 8i sees an infinite loop in that code, but not 11g and up. Why ?



      Note: I know 8i is old. I have no control over that.










      share|improve this question
















      I found the code for a row generator from this question Create View with 365 days



      CREATE VIEW year_days (the_day) AS
      SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
      FROM DUAL
      CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
      /
      SELECT * FROM year_days


      Since I don't have CREATE privileges, I modified it to an inline-query form :



      SELECT
      year_days.*
      FROM
      (
      SELECT TRUNC(SYSDATE, 'YYYY') + (LEVEL-1) AS the_day
      FROM DUAL
      CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),11)), 'DDD'))
      ) year_days


      The inline-query code above works perfectly fine on one of our Oracle 11g R2 (v11.2.0.3.0) instance, as well as on Oracle's own LiveSQL (19c, v19.2.0.0.0).



      However, it does not work on the instance that it needs to run on, which is 8i (v8.1.7.4.0).
      I get ORA-01436: CONNECT BY loop in user data.



      At first glance it seems that 8i sees an infinite loop in that code, but not 11g and up. Why ?



      Note: I know 8i is old. I have no control over that.







      sql oracle connect-by oracle8i






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 21:02









      Littlefoot

      30.4k7 gold badges17 silver badges34 bronze badges




      30.4k7 gold badges17 silver badges34 bronze badges










      asked Mar 25 at 20:46









      mach128xmach128x

      338 bronze badges




      338 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          If it doesn't have to be a connect by query, how about something simpler, such as



          select rownum
          from all_objects
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          or perhaps



          select rownum 
          from (select null from dual
          group by cube (1, 2, 3, 4, 5, 6, 7, 8, 9, 20)
          )
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          which both should work on Oracle 8i.



          More nice row generator techniques on OraFAQ Forum, here: http://www.orafaq.com/forum/t/95011/102589/






          share|improve this answer























          • I am aware that other row generation techniques exist. However, this does not answer the question.

            – mach128x
            Mar 26 at 21:15












          • OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

            – Littlefoot
            Mar 26 at 21:17












          • For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

            – mach128x
            Mar 26 at 22:24












          • My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

            – mach128x
            Mar 26 at 22:33











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346167%2fconnect-by-clause-works-on-11g-but-not-on-oracle-8i-ora-01436-connect-by-loo%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          If it doesn't have to be a connect by query, how about something simpler, such as



          select rownum
          from all_objects
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          or perhaps



          select rownum 
          from (select null from dual
          group by cube (1, 2, 3, 4, 5, 6, 7, 8, 9, 20)
          )
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          which both should work on Oracle 8i.



          More nice row generator techniques on OraFAQ Forum, here: http://www.orafaq.com/forum/t/95011/102589/






          share|improve this answer























          • I am aware that other row generation techniques exist. However, this does not answer the question.

            – mach128x
            Mar 26 at 21:15












          • OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

            – Littlefoot
            Mar 26 at 21:17












          • For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

            – mach128x
            Mar 26 at 22:24












          • My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

            – mach128x
            Mar 26 at 22:33
















          1














          If it doesn't have to be a connect by query, how about something simpler, such as



          select rownum
          from all_objects
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          or perhaps



          select rownum 
          from (select null from dual
          group by cube (1, 2, 3, 4, 5, 6, 7, 8, 9, 20)
          )
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          which both should work on Oracle 8i.



          More nice row generator techniques on OraFAQ Forum, here: http://www.orafaq.com/forum/t/95011/102589/






          share|improve this answer























          • I am aware that other row generation techniques exist. However, this does not answer the question.

            – mach128x
            Mar 26 at 21:15












          • OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

            – Littlefoot
            Mar 26 at 21:17












          • For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

            – mach128x
            Mar 26 at 22:24












          • My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

            – mach128x
            Mar 26 at 22:33














          1












          1








          1







          If it doesn't have to be a connect by query, how about something simpler, such as



          select rownum
          from all_objects
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          or perhaps



          select rownum 
          from (select null from dual
          group by cube (1, 2, 3, 4, 5, 6, 7, 8, 9, 20)
          )
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          which both should work on Oracle 8i.



          More nice row generator techniques on OraFAQ Forum, here: http://www.orafaq.com/forum/t/95011/102589/






          share|improve this answer













          If it doesn't have to be a connect by query, how about something simpler, such as



          select rownum
          from all_objects
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          or perhaps



          select rownum 
          from (select null from dual
          group by cube (1, 2, 3, 4, 5, 6, 7, 8, 9, 20)
          )
          where rownum <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'));


          which both should work on Oracle 8i.



          More nice row generator techniques on OraFAQ Forum, here: http://www.orafaq.com/forum/t/95011/102589/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 20:53









          LittlefootLittlefoot

          30.4k7 gold badges17 silver badges34 bronze badges




          30.4k7 gold badges17 silver badges34 bronze badges












          • I am aware that other row generation techniques exist. However, this does not answer the question.

            – mach128x
            Mar 26 at 21:15












          • OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

            – Littlefoot
            Mar 26 at 21:17












          • For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

            – mach128x
            Mar 26 at 22:24












          • My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

            – mach128x
            Mar 26 at 22:33


















          • I am aware that other row generation techniques exist. However, this does not answer the question.

            – mach128x
            Mar 26 at 21:15












          • OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

            – Littlefoot
            Mar 26 at 21:17












          • For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

            – mach128x
            Mar 26 at 22:24












          • My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

            – mach128x
            Mar 26 at 22:33

















          I am aware that other row generation techniques exist. However, this does not answer the question.

          – mach128x
          Mar 26 at 21:15






          I am aware that other row generation techniques exist. However, this does not answer the question.

          – mach128x
          Mar 26 at 21:15














          OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

          – Littlefoot
          Mar 26 at 21:17






          OK, no problem. I hope at least one of them will satisfy your (and 8i's) needs.

          – Littlefoot
          Mar 26 at 21:17














          For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

          – mach128x
          Mar 26 at 22:24






          For future reference and to help others, this is the best article / script collection I found on the topic of row generators : "ROW GENERATOR - Methods to Generate Series", livesql.oracle.com/apex/livesql/file/…

          – mach128x
          Mar 26 at 22:24














          My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

          – mach128x
          Mar 26 at 22:33






          My preference went to the 'hierarchical query method' based on the above reference from Oracle. It should work on 8i. There must be some intricacies to that specific version that I need to discover and understand to make it work.

          – mach128x
          Mar 26 at 22:33









          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346167%2fconnect-by-clause-works-on-11g-but-not-on-oracle-8i-ora-01436-connect-by-loo%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

          Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?