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

From: <sybrandb_at_hccnet.nl>
Date: Thu, 09 Oct 2008 06:43:09 +0200
Message-ID: <gq2re4p4bsggint6ncp7njfc2iqbt8ntdu@4ax.com>


On Thu, 09 Oct 2008 00:12:25 GMT, 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
>
>Many TIA!
>Mark

You have two options:
either using the correct datatype avoiding implicit conversion, or realizing you could express a minute as a fraction of a data, as the unit of a date column is a day.

Apart from that: you need to post a version (4 digits) and stop posting this in the wrong forum, .misc.
The correct forum is .server.

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Wed Oct 08 2008 - 23:43:09 CDT

Original text of this message