Minute Differences [message #311641] |
Sat, 05 April 2008 06:24  |
mudalimuthu
Messages: 64 Registered: May 2005 Location: Bangalore
|
Member |
|
|
Select ((To_Date('04-04-2008 06:23:45', 'DD-MM-YYYY HH24.MI.SS') - To_Date('03-04-2008 23:23:45', 'DD-MM-YYYY HH24.MI.SS') ) ) * (1440) TotMins
From Dual
this above SQL gives the Minute Difference from one todatetime to fromdatetime...
when i pass a parameter to this in my application
i am getting the following error...
ORA-01840: input value not long enough for date format ORA-06512
Regards
Muthu
|
|
|
|
Re: Minute Differences [message #311645 is a reply to message #311643] |
Sat, 05 April 2008 07:08   |
mudalimuthu
Messages: 64 Registered: May 2005 Location: Bangalore
|
Member |
|
|
Select ((To_Date( Nvl( :TDateTime , SysDate ) , 'DD-MM-YYYY HH24.MI.SS') - To_Date( Nvl ( :FDateTime , SysDate ) , 'DD-MM-YYYY HH24.MI.SS') ) ) * (1440) TotMins
From Dual
Parameters -
:TDateTime
:FDateTime
|
|
|
Re: Minute Differences [message #311648 is a reply to message #311645] |
Sat, 05 April 2008 07:15   |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
Why do you have the NVL? Are you sometimes passing empty bind variables?
You should not have different data types in the two arguments of NVL(). Make them either both VARCHAR2 or both DATE.
eg.
TO_DATE(NVL(:TDateTime, TO_CHAR(sysdate, 'DD-MM-YYYY HH24.MI.SS'))
,'DD-MM-YYYY HH24.MI.SS')
Ross Leishman
|
|
|
|
|
|
|
|
|
|