Basically user cannot enter any reason_codes if there is already an existing schedule for that schedule_date and time.
select schedule_date,payroll_id,start_time,
start_ampm,total_hours,end_time,end_ampm
from dept_staff
where payroll_id = 'ZZW0024100'
and schedule_date = '01-oct-2012'
I entered the same start time, start_ampm, but changed the total_hours to 7.0 instead of 8.0 as previous testing. Did not give me error. Its not logical to enter any time if that schedule exists. I tried to change my query from count(*) from the previous answered question to the following
select count(*) into v_count
from dept_staff
where payroll_id = :dept_staff.payroll_id
and schedule_date = :dept_staff.schedule_date
and start_time = :dept_staff.start_time
and end_time = :dept_staff.end_time
and start_ampm = :dept_staff.start_ampm
and end_ampm = :dept_staff.end_ampm;
Thats why for my second test it did not stop from entering. Is there a way to modify the query to make sure the user will not be able to enter any thing between those time schedule that is present for that date? screen1.jpg screen2.jpg