Home » Developer & Programmer » Forms » FRM-40102 record must be entered or deleted---------error (oracle forms 6i)
FRM-40102 record must be entered or deleted---------error [message #666917] Fri, 01 December 2017 03:10 Go to next message
ms goyal
Messages: 1
Registered: December 2017
Junior Member
I write a cursor in button trigger "WHEN BUTTON PRESSED":

In this i have to insert values in table if user enter the date in ":TM.NEW_APP" column if that column is null then update the data in table

DECLARE
   CURSOR C1
   IS
      SELECT DISTINCT (CID) AS id1,
                      cname,
                      contact,
                      app_date,
                      old_remarks,
                      new_app,
                      new_remarks,
                      s_date,
                      t_id
        FROM TRA_MASTER;
BEGIN
   GO_BLOCK ('TM');
   FIRST_RECORD;

   FOR I IN C1
   LOOP
      IF ( :TM.NEW_APP IS NOT NULL)
      THEN
         INSERT INTO TRA_MASTER
              VALUES ( :TM.ID,
                      :TM.name,
                      :TM.contact,
                      :TM.app_date,
                      :TM.old_remarks,
                      :TM.new_app,
                      :TM.new_remarks,
                      :TM.s_date,
                      :TM.t_id);
      ELSE
         UPDATE TRA_MASTER
            SET S_DATE = SYSDATE
          WHERE CID = :tm.ID;
      END IF;

      NEXT_RECORD;
   END LOOP;

   CLEAR_RECORD;
   FIRST_RECORD;
END;

When i tried to run this code, it shows
FRM-40102: Record must be entered or deleted first.
Moreover it's also not terminating


[EDITED by LF: formatted code and applied [code] tags]

[Updated on: Fri, 01 December 2017 04:20] by Moderator

Report message to a moderator

Re: FRM-40102 record must be entered or deleted---------error [message #666919 is a reply to message #666917] Fri, 01 December 2017 04:18 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
That code makes zero sense.
You're looping over a cursor and within the cursor looping over a datablock.
But there's no obvious relationship between the cursor results and the contents of the datablock.
Why the cursor loop?
What is the block based on?
Why would you assume a datablock item being not null means an insert is necessary?
Previous Topic: WebUtil_File.File_Save_Dialog not change folder when user selection new
Next Topic: master and detail form
Goto Forum:
  


Current Time: Thu Mar 28 09:43:48 CDT 2024