Re: comparing a DATE column with "one minute ago", type warning?

From: Laurenz Albe <invite_at_spam.to.invalid>
Date: 09 Oct 2008 10:14:09 GMT
Message-ID: <1223547245.636520@proxy.dienste.wien.at>


mh_at_pixar.com wrote:
> How should I be comparing a DATE column with "one minute ago"?
>
> I do this:
> select sysdate, sysdate- interval '1' minute from dual;
>
> and get just what I need, the time a minute ago:
>
> SYSDATE SYSDATE-INTERVAL'1'MINUTE
> ------------------------- -------------------------
> 08-OCT-08 17:09:19 08-OCT-08 17:08:19
>
> But in my PL/SQL, I get a warning on this code, where
> lastping is a DATE column:
>
> update mytable
> set status='silent'
> where lastping < (sysdate - interval '1' minute);
> ^ ^
> col 28 col 36
>
> Warning(16,28): PLW-07202: bind type would result in conversion
> away from column type
> Warning(16,36): PLW-07202: bind type would result in conversion
> away from column type

I'd say that the warning is bogus and should be ignored.

According to
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#g196492 the difference between DATE and INTERVAL is a DATE, so if lastping is a DATE there should be no implicit conversion necessary.

Yours,
Laurenz Albe Received on Thu Oct 09 2008 - 05:14:09 CDT

Original text of this message