Getting data from the next row in Oracle cursor

Posted by Chaotic_one on Stack Overflow See other posts from Stack Overflow or by Chaotic_one
Published on 2010-06-15T06:59:53Z Indexed on 2010/06/15 7:02 UTC
Read the original article Hit count: 150

Filed under:
|
|

Hi, I'm building nested tree and I need to get data for the next row in cursor, using Oracle. And I still need current row, so looping forward is not a solution. Example:

  OPEN emp_cv FOR sql_stmt;
  LOOP
  FETCH emp_cv INTO v_rcod,v_rname,v_level;
  EXIT WHEN emp_cv%NOTFOUND; 
  /*here lies the code for getting v_next_level*/
      if v_next_level > v_level then
          /*code here*/
          elsif v_next_level < v_level then
          /*code here*/
          else
          /*code here*/
          end if;
  END LOOP;
  CLOSE emp_cv;

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle