Home » Developer & Programmer » Forms » where is the error within this form? (10g)
where is the error within this form? [message #328077] Wed, 18 June 2008 21:05 Go to next message
amdabd
Messages: 91
Registered: November 2007
Location: My Computer
Member
hi,
my aim is to retrieve data from table EMP into table SAL_3
using cursor within a form.
the form gives error [FRM-40102: Record must be entered or deleted first.]

table SAL_3
------------
EMPNO    NUMBER(4),
ENAME    VARCHAR2(10),
SAL      NUMBER(7,2),
COMM     NUMBER(7,2)

thanks

[Updated on: Wed, 18 June 2008 21:09]

Report message to a moderator

Re: where is the error within this form? [message #328083 is a reply to message #328077] Wed, 18 June 2008 22:28 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

Hi download the your form

none of coding available in your form.

If i get clear picture then i can try to solve your issues.

kanish.

Re: where is the error within this form? [message #328118 is a reply to message #328083] Thu, 19 June 2008 00:06 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
There are several problems in the form.

You have never navigated out of the 'block2' block. Trigger you've written deals with 'sal_3' block (at least, that's what you think), but NEXT_RECORD is trying to create a record in the 'block2' block, not in 'sal_3'.

In order to get into the 'sal_3' block, it must have at least one navigable item. So, either make one of these items navigable, or add another one which will suit such a need.

Finally, there's a "better" way to use a cursor - although your way works (incorrectly, though - the last employee is displayed twice; you should think it over), it is better to use a cursor FOR loop as you don't have to declare cursor variable(s), open a cursor, worry when to exit (EXIT should follow FETCH if you want to avoid duplicating the last employee) and close a cursor.

Here's how it might look like:
begin
  if :block2.txt_deptno is null then
     message('Enter dept number');
  else
     go_block('sal_3');
     for cur_r in (select empno, ename, sal, comm, deptno
                   from emp
                   where deptno = :block2.txt_deptno
                  )
     loop
       :sal_3.empno := cur_r.empno;
       :sal_3.ename := cur_r.ename;
       :sal_3.sal := cur_r.sal;
       :sal_3.comm := cur_r.comm;
       	 
       next_record;
     end loop;
  end if;
end;
Re: where is the error within this form? [message #328119 is a reply to message #328083] Thu, 19 June 2008 00:07 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
mm_kanish05 wrote on Thu, 19 June 2008 05:28
none of coding available in your form.

Did you, perhaps, try to open 10g form with Reports Builder 6i? If so, it *might* prevent you from viewing form's PL/SQL code.
Re: where is the error within this form? [message #328135 is a reply to message #328077] Thu, 19 June 2008 01:27 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

sorry little

i was try in Form 6i.


kanish
Re: where is the error within this form? [message #328362 is a reply to message #328118] Thu, 19 June 2008 20:54 Go to previous message
amdabd
Messages: 91
Registered: November 2007
Location: My Computer
Member
hi;
thanks dear Littlefoot
it works properly .
Littlefoot wrote on Thu, 19 June 2008 00:06
You have never navigated out of the 'block2' block. Trigger you've written deals with 'sal_3' block (at least, that's what you think), but NEXT_RECORD is trying to create a record in the 'block2' block, not in 'sal_3'.
Actually, Yes this was my error.

thanks everybody
Previous Topic: How to get rid of the DOT
Next Topic: how to invoke the LOV?
Goto Forum:
  


Current Time: Sun Feb 09 23:39:57 CST 2025