dbTalk Databases Forums  

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

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss comparing a DATE column with "one minute ago", type warning? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mh@pixar.com
 
Posts: n/a

Default comparing a DATE column with "one minute ago", type warning? - 10-08-2008 , 07:12 PM






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

Reply With Quote
  #2  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-08-2008 , 11:43 PM






On Thu, 09 Oct 2008 00:12:25 GMT, mh (AT) pixar (DOT) com wrote:

Quote:
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



Reply With Quote
  #3  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-08-2008 , 11:43 PM



On Thu, 09 Oct 2008 00:12:25 GMT, mh (AT) pixar (DOT) com wrote:

Quote:
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



Reply With Quote
  #4  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-08-2008 , 11:43 PM



On Thu, 09 Oct 2008 00:12:25 GMT, mh (AT) pixar (DOT) com wrote:

Quote:
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



Reply With Quote
  #5  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-08-2008 , 11:43 PM



On Thu, 09 Oct 2008 00:12:25 GMT, mh (AT) pixar (DOT) com wrote:

Quote:
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



Reply With Quote
  #6  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-09-2008 , 05:14 AM



mh (AT) pixar (DOT) com wrote:
Quote:
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/B...01.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


Reply With Quote
  #7  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-09-2008 , 05:14 AM



mh (AT) pixar (DOT) com wrote:
Quote:
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/B...01.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


Reply With Quote
  #8  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-09-2008 , 05:14 AM



mh (AT) pixar (DOT) com wrote:
Quote:
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/B...01.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


Reply With Quote
  #9  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-09-2008 , 05:14 AM



mh (AT) pixar (DOT) com wrote:
Quote:
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/B...01.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


Reply With Quote
  #10  
Old   
ddf
 
Posts: n/a

Default Re: comparing a DATE column with "one minute ago", type warning? - 10-09-2008 , 07:12 AM



On Oct 8, 7:12*pm, m... (AT) pixar (DOT) com wrote:
Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.