Avatar of anumoses
anumoses
Flag for United States of America

asked on 

oracle query

Already answered question

https://www.experts-exchange.com/questions/27763628/oracle-query-in-a-loop.html.

Having problems

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'

SCHEDULE_DATE|PAYROLL_ID|START_TIME|START_AMPM|TOTAL_HOURS|END_TIME|END_AMPM
10/1/2012|ZZW0024100|800|A|800|400|P

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
Oracle Database

Avatar of undefined
Last Comment
anumoses

8/22/2022 - Mon