Home » Developer & Programmer » Forms » FRM-40102: Record must be entered or deleted first
FRM-40102: Record must be entered or deleted first [message #251748] Mon, 16 July 2007 08:58 Go to next message
harleenflora
Messages: 44
Registered: June 2006
Member
Any ideas why am I getting following error message when I am trying to display all records in the data block through cursor?

FRM-40102: Record must be entered or deleted first.

Data block is just displaying the last record and not all records, why?

Cursor:
declare
cursor c1 is
select last_name, first_name
from health_val
order by id;
-- rec_c1 health_val%rowtype;
begin
open c1;
loop
fetch c1 into
:health_val.last_name,
:health_val.first_name;
message(:health_val.last_name);
exit when c1%notfound;
next_record;
end loop;
close c1;
end;

Please let me know....
Re: FRM-40102: Record must be entered or deleted first [message #251785 is a reply to message #251748] Mon, 16 July 2007 11:55 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I believe it is about NAVIGATION.

How do you run this code? Using a button, for example? If so, well, button belongs to a block which is NOT the "health_val" block and the whole code is executed on a wrong block (i.e. you are going to the NEXT_RECORD in a control block). So, in order to make it work, include GO_BLOCK('health_val'); into the trigger code.

Also, you might want to consider a CURSOR FOR LOOP - it will make the code easier to maintain (no need to declare a cursor, open it, fetch, exit and close it); something like this:
begin
  go_block('health_val');
  
  for cr in (select last_name, first_name from health_val order by id)
  loop
    :health_val.last_name  := cr.last_name;
    :health_val.first_name := cr.first_name;
  end loop;
end;
Re: FRM-40102: Record must be entered or deleted first [message #305823 is a reply to message #251785] Wed, 12 March 2008 02:32 Go to previous messageGo to next message
masterborj
Messages: 21
Registered: October 2007
Location: Philippines
Junior Member

Littlefoot wrote on Tue, 17 July 2007 00:55
I believe it is about NAVIGATION.

How do you run this code? Using a button, for example? If so, well, button belongs to a block which is NOT the "health_val" block and the whole code is executed on a wrong block (i.e. you are going to the NEXT_RECORD in a control block). So, in order to make it work, include GO_BLOCK('health_val'); into the trigger code.

Also, you might want to consider a CURSOR FOR LOOP - it will make the code easier to maintain (no need to declare a cursor, open it, fetch, exit and close it); something like this:
begin
  go_block('health_val');
  
  for cr in (select last_name, first_name from health_val order by id)
  loop
    :health_val.last_name  := cr.last_name;
    :health_val.first_name := cr.first_name;
  end loop;
end;




I'm new in using forms and I'm using dev. 10g. I'm trying to develop a program and try to use your code but it looks like it only display the last record....
my code goes like this
begin
  go_block('block65');
  
  for cr in (select sccode, scname from sampletable order by sccode)
  loop
    :block65.sccode := cr.sccode;
    :block65.scname := cr.scname;
  end loop;
end;

any help please....
Re: FRM-40102: Record must be entered or deleted first [message #305829 is a reply to message #305823] Wed, 12 March 2008 02:45 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, indeed ... because of a bug (sorry) - noone moves to the next record!

Correctly written version would be
begin
  go_block('block65');
  
  for cr in (select sccode, scname from sampletable order by sccode)
  loop
    :block65.sccode := cr.sccode;
    :block65.scname := cr.scname;

    next_record;                      --> this one is missing!
  end loop;
end;
Previous Topic: Builtin Logon procedure slow
Next Topic: SHORT CUT RUN DONT DISPLAY ITEM
Goto Forum:
  


Current Time: Sun Feb 09 04:18:59 CST 2025