locked
time compare RRS feed

  • Question

  • User-1075092149 posted

    my db table has many field: id, date, starttime, endtime (format: 00:00 to 23:00)

    same id will have many same date. and same date will contain different starttime and endtime.

    when i insert the data into database. how can i prevent the starttime and endtime in the database will not overlaps the input starttime and input endtime???

    and output -1 if overlaps.

     

    how can i create a stored procedure in Oracle.

    Friday, December 14, 2012 1:42 AM

All replies

  • User-151368862 posted

    create a composite primary key consisting of columns:
    userid, date, starttime, endtim

    Friday, December 14, 2012 2:33 AM
  • User-151368862 posted

    if u wont change the structure, you must first use a select query with the database to know
    if the same time already exists (compare it with input time and notify user without going for insert)

    Friday, December 14, 2012 2:38 AM
  • User-1075092149 posted

    if u wont change the structure, you must first use a select query with the database to know
    if the same time already exists (compare it with input time and notify user without going for insert)

     

    i have time interval

    Sunday, December 30, 2012 12:51 PM