Home » SQL & PL/SQL » SQL & PL/SQL » Difference between two dates
Difference between two dates [message #234596] Wed, 02 May 2007 10:58 Go to next message
mach460
Messages: 5
Registered: March 2007
Junior Member
Hi All...

I am a getting a Error: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
when trying to calculate difference between two dates in my case statement. The difference worked fine for the 2nd WHEN statement, but I get an error when trying to replace hard-coded number with a Previous period date (in red) in the first line.....Below is my CASE statement

CASE
WHEN C.ISSUE_DT > (D.AS_OF_DATE - D.DT_AS_OF_PPD) THEN (D.AS_of_date - C.ISSUE_DT)+3
WHEN D.PRINCIPAL_BALANCE*-1 = E.PRINCIPAL_BALANCE*-1 AND C.FM_NAME_STRUC_CAT = 'DN_ST_NC_ZERO_US' THEN D.AS_OF_DATE - D.DT_AS_OF_PPD
ELSE 30
END AS DAY_CT

Any help is appreciated...

Thanks
Mach
Re: Difference between two dates [message #234602 is a reply to message #234596] Wed, 02 May 2007 11:23 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
What datatype do you expect from a subtraction of two dates?
How much is tomorrow minus today? Would that be 'one day' (a number) or 'yesterday' (a date)?

So, you are comparing a date with a number.
Re: Difference between two dates [message #234633 is a reply to message #234596] Wed, 02 May 2007 13:32 Go to previous message
mach460
Messages: 5
Registered: March 2007
Junior Member
Thanks....I figured out after I posted the question.....
Previous Topic: IMP-00002 and IMP-00010
Next Topic: XML file in Oracle
Goto Forum:
  


Current Time: Thu Dec 08 18:38:48 CST 2016

Total time taken to generate the page: 0.10910 seconds