Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012

    Unanswered: recursive code --> infinite loop

    Hallo everyone,

    I have built a recursive sql code. This code never stops, so that I have to kill the process. As it was running, I did monitor the run of the code with tool db2mon. The problem is that after some times it keeps reading, but not fetching or writing anymore.

    As the warning "... may contain infinite loop ..." accured, I looked at the manual of db2. The manual says that there are 2 important things to be added in the where clauses. One of them is:

    The where clause should include the limit gap:
    countColumn < Constant
    [/CODE]countColumn < HostVariable[/CODE]

    In my code, for that I have fulfilled this, BUT insted of <, it is a <= (not smaller than, but smaller than or even)

    I am confused if that could be the problem, why sql is still reading and reading.

    I know it is a complex theme, but is there any common considerations if the code is not stopping?

    Thank you.


  2. #2
    Join Date
    Apr 2006
    Provided Answers: 11
    if possible : always publish full sql code - level and platform
    as the fetch does not occur anymore (no more rows) the counter is not incrementing anymore and is always equal to the :hv
    there are many samples in the forum about this and also in information center
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified

  3. #3
    Join Date
    May 2012
    Hallo przytula_guy,

    thank you for the hint. Your hint drove me to take another concept to run my recursive sql. And it works


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts