Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    india,hyderabad
    Posts
    43

    Unanswered: re: viewing loop counter

    hi! Guys ,

    I am running a proc in which there is a loop

    for i in 1..100000 loop
    .....
    end loop;

    how do i monitor what "i" is
    how do I keep watching "i" to see what value it is at ...

    1) from sqlplus
    OR
    2) from OEM console
    harry

  2. #2
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    273
    FOR i IN 1..100000 LOOP
    .....
    .....

    FOR j IN 1..100000 LOOP
    DBMS_OUTPUT.PUT_LINE (
    'Current Value of I is: '||i);
    END LOOP;
    END LOOP
    Bhavin

    MS Computer Science
    OCP DBA 9i/8i

  3. #3
    Join Date
    Apr 2004
    Posts
    246
    dbms_output won't give you anything until the procedure is done.
    to monitor it real time, use dbms_application_info.set_action, passing the value of "i", along with whatever else might be usefull. You can then see this value from another session querying v$session.

  4. #4
    Join Date
    Apr 2004
    Location
    Toronto, Canada
    Posts
    249
    There is another way to do it.

    At frequent intervals, say 1000 iterations or so, log this information into a database table.

    Then another session can query this log table and thus monitor this session.

    As a further benefit, if you are logging other information such as timestamp, etc., then you may be able to analyze the performance over time.

    I am assuming that you are running a large process requiring significant time to complete, and you want to see if there is real progress, or the process is just "hanging".

    Ravi

Posting Permissions

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