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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -