How to Get Previous Record Value in Oracle Forms?

To get previous record value in Oracle Forms, use Previous_Record built-in. Previous_Record command navigates to the next lower sequence number than the current record. To get the current record number you can use System.Cursor_Record system variable. Below is the example:

Get Previous Record Values in Oracle Forms Example

Suppose you have a database block EMP and there are fields empno, ename, job and you want to get previous record values for some purpose, then create a push button and on that button click trigger, use Previous_Record built-in as shown in the below example:

   l_prev_empno   emp.empno%TYPE;
   l_prev_ename   emp.ename%TYPE;
   l_prev_job     emp.job%TYPE;
   IF TO_NUMBER (:SYSTEM.cursor_record) > 1
      PREVIOUS_RECORD; /* move to the previous record and get previous record values */
      l_prev_empno := :emp.empno;
      l_prev_ename := :emp.ename;
      l_prev_job := :emp.job;
      NEXT_RECORD;    /* come back to the current record */
   END IF;

See also:

Leave a Comment