sql - Function in Informix to return number of minutes between two Datetimes -
here's have (it doesn't work):
create function difference_in_minutes(start datetime, end datetime) returning ((start - end)::interval minute(8) minute)::char(10)::int8;
i want able use this: where difference_in_minutes(starttime, endtime) > 100
example. correct way accomplish that? i'm using informix 11.70.
obviously you've discovered difficulty of converting interval
values integer
, problem in code syntactical, think. use of reserved words start
, end
may complicating things, too.
try this:
create function difference_in_minutes(a datetime year second, b datetime year second) returning int8; return ((b - a)::interval minute(8) minute)::char(10)::int8; end function;
i tested using function predicate, , seems work fine.
Comments
Post a Comment