Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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