Home » Developer & Programmer » Forms » PUSH BUTTON TRIGGER CODE ERROR(5 Merged) (D2K (FORMS 6I))
PUSH BUTTON TRIGGER CODE ERROR(5 Merged) [message #543710] Thu, 16 February 2012 08:56 Go to next message
dhuleap1@mahadiscom.in
Messages: 2
Registered: February 2012
Junior Member
I wrote following code in Push Button trigger "when-mouse-clicked"

but m getting error 0 at line 0 column 0
ora -000600

please give me solution. whats wrong in code?


declare
cursor c1 is select * from nov11 ;
c_val c1%ROWTYPE ;
cnt INTEGER(5) := 0 ;
begin
open c1 ;
loop
fetch c1 into c_val ;
exit when c1%NOTFOUND ;

update nov11 set LOSS = 5 + dbms_random.value(1, 6 )
where dtc_code = c_val.dtc_code and c_val.LOSS < 0 ;



end loop ;

end ;
  • Attachment: MODULE1.fmb
    (Size: 40.00KB, Downloaded 1089 times)
Re: PUSH BUTTON TRIGGER CODE ERROR [message #543716 is a reply to message #543710] Thu, 16 February 2012 09:01 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/

ORA-00600/ORA-07445/ORA-03113 = Oracle bug => search on Metalink and/or call Oracle support
Re: PUSH BUTTON TRIGGER CODE ERROR [message #543718 is a reply to message #543716] Thu, 16 February 2012 09:12 Go to previous messageGo to next message
dhuleap1@mahadiscom.in
Messages: 2
Registered: February 2012
Junior Member
@BlackSwan
thank you sir. but at least tell me, is my code right? As I am anew to Developer 2K. I have set of few queries, but I want to put it in FORM. Please guide me with the same
Re: PUSH BUTTON TRIGGER CODE ERROR [message #543720 is a reply to message #543718] Thu, 16 February 2012 09:18 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
any code that throws any error is not 100% correct.

By the way this board has sub-forum dedicated to Forms.
Re: PUSH BUTTON TRIGGER CODE ERROR [message #543773 is a reply to message #543720] Thu, 16 February 2012 14:56 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You "forgot" to close a cursor. Add this statement to your code.

Avoid "SELECT *" - always name all columns you are selecting.

I removed a variable you never used and properly fomatted your procedure. Please, do the same next time you post some code.

declare
  cursor c1 is select dtc_code, loss 
    from nov11 ;
  c_val c1%ROWTYPE ;
begin
  open c1 ;
  loop
    fetch c1 into c_val ;
    exit when c1%NOTFOUND ;

    update nov11 set 
      LOSS = 5 + dbms_random.value(1, 6)
    where dtc_code = c_val.dtc_code 
      and c_val.LOSS < 0;
 
  end loop ;
  
  close c1;        --> you miss it!
end ;

If it still doesn't work in Forms, try to remove DBMS_RANDOM call; maybe Forms 6i don't like it.

Test the procedure in SQL*Plus. If it works properly there (but not in Forms), create a stored procedure and call it from a form (it doesn't depend on form items' values anyway).
Re: PUSH BUTTON TRIGGER CODE ERROR [message #543778 is a reply to message #543773] Thu, 16 February 2012 15:34 Go to previous message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
The code could be more simply written as:
UPDATE nov11
SET loss = 5 + dbms_random.value(1, 6)
WHERE loss < 0

No cursors required
Previous Topic: Message is not displaying
Next Topic: what's wrong with this code?
Goto Forum:
  


Current Time: Tue Jul 09 22:18:43 CDT 2024