Re: comparing a DATE column with "one minute ago", type warning?
Date: Thu, 9 Oct 2008 05:12:45 -0700 (PDT)
Message-ID: <1b21f42e-8107-4014-a812-03cfd9f9adae@g17g2000prg.googlegroups.com>
On Oct 8, 7:12�pm, m..._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
>
> --
> Mark Harrison
> Pixar Animation Studios
You could also do this:
update mytable set status='silent' where lastping < (sysdate - 1/1440);
and achieve the same result.
David Fitzjarrell Received on Thu Oct 09 2008 - 07:12:45 CDT