Link to home
Create AccountLog in
Avatar of anumoses
anumosesFlag for United States of America

asked on

oracle forms question

Have this code

select count(*) into v_count
  from day_off_sched
  where schedule_code = :day_off_sched.schedule_code;
If v_count > 0 then
msgbox.show('Schedule Error ', 'The Schedule you entered already exixts.', 'OK');
       :day_off_sched.schedule_code := null;
          raise form_trigger_failure;      
Else      

go_item('day_off_sched.description');      
End if;
-----------
I want this code to fire only on inserting record . not when we query records .
I have this code on key-enter of the schedule code.
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of anumoses

ASKER

I tried the code in when-create-record of the block but did not fire the error.
 My code is

Declare

v_count number;      

Begin

select count(*) into v_count
  from day_off_sched
  where schedule_code = :day_off_sched.schedule_code;
 
If v_count > 0 then
        
msgbox.show('Schedule Error ', 'The Schedule you entered already exixts.', 'OK');
       :day_off_sched.schedule_code := null;
          raise form_trigger_failure;      
Else      

go_item('day_off_sched.description');      
End if;      
End;
Avatar of Sean Stuber
Sean Stuber

if new record create didn't work,   did you try when new record instance?
when-new-record-instance did not work either.
thanks