Interval and stored proc
Posted in 2000
Topics: General Discussion
Does anyone know of a way to match certain records in a table
that has a DATETIME column based on a variable number of hours?
Here's what I would really like to be able to do within a stored
proc:
DEFINE intHours;
UPDATE rest_employee SET login_dts = NULL, shift = NULL
WHERE CURRENT - login_dts > INTERVAL (intHours) HOUR TO HOUR
I cannot do it because the INTERVAL keyword must have a literal
as it's parameter.
Please reply to my email as well as this post.
Thanx.
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
The solution:
UPDATE rest_employee SET login_dts = NULL, shift = NULL
WHERE login_dts < CURRENT - intHours UNITS HOUR;
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com