title: Oracle forms FRM-40102:RECORD MUST BE ENTERED OR DELETED FIRST
body: <p>I made this in a button on oracle forms to fill a form automatically from several table records and when I run the form it throws the error FRM - 40102 RECORD MUST BE ENTERED OR DELETED FIRST</p>
  
  <p>I tried manually deleting the default record first but it doesn't seem to change.</p>
  
  <pre><code>DECLARE
   /* cursor declaration */
  
   CURSOR C IS 
   SELECT ALU.IDEALU, EVA.IDEEVA, UNI.IDEUNI, MAT.IDEMAT
   FROM ALU, EVA, UNI, MAT
   ORDER BY ALU.IDEALU;
  
   ALT NUMBER;
   R C%ROWTYPE;
   N NUMBER;
   errnum NUMBER       := ERROR_CODE; 
     V_CONT NUMBER;
     AL_CONT NUMBER;
   V_ADD_AMT NUMBER; 
   V_ADD_DEDUCT NUMBER; 
   V_SAL_ADD_AMT NUMBER;
   BEGIN
  
   SELECT COUNT(IDEALU) INTO AL_CONT
   FROM ALU;
  
  /*cursor open*/
   OPEN C;
   --================= 
     IF errnum = 40508 THEN     
          ALT:=SHOW_ALERT('FAIL');
          RAISE Form_Trigger_Failure; 
     END IF;      
   --================     
        GO_BLOCK('CAAE');     
        IF AL_CONT=0 THEN
        FIRST_RECORD;
        ALT:=SHOW_ALERT('FAIL');
        ELSE
             LAST_RECORD;
             NEXT_RECORD;
        END IF;
        NEXT_RECORD;
   LOOP
    FETCH C INTO R;               ----cursor fetch/read      
    :CAAE.CAAEALU:=R.IDEALU;         --- data assign...
    :CAAE.CAAEEVA:=R.IDEEVA;
    :CAAE.CAAEUNI:=R.IDEUNI;
    :CAAE.CAAEMAT:=R.IDEMAT;
    EXIT WHEN C%NOTFOUND; 
    NEXT_RECORD;  
   END LOOP;
   PREVIOUS_RECORD;
   CLOSE C;
  
  END;
  </code></pre>