i have a table with a time field and i need to add an int field to it.
here’s the line of code (it’s a piece of a trigger.)
DECLARE duration Int;
[....]
SET NEW.appointmentEnd = NEW.appointmentTime + duration;
This works until the time gets to a full hour. So 8:30:00 + 1500 = 8:45:00 But 8:30:00 + 3000 = 0:00:00.
How to fix this?
Thanks in advance! 🙂
Instead of adding a “plain” int, you should be adding anexplicit interval:
You are not limited to using
MINUTE, of course: you can useSECONDif you need more precision.