Count days between two dates

Kym

Member
I'm trying to add a column that displays the number of days between two dates. What I have:
[ ,trim(zopn.user_fld13) as "Site Location"
,Sopn.Plan_start_dt as "Start Date"
,Sopn.Pln_due_dt as "End Date"
,datediff (day, Sopn.Plan_start_dt, Sopn.Pln_due_dt)]
'datediff' is not recognised.

Thank you.
 
You can simply subtract the 2 dates:

select Sopn.Pln_due_dt - Sopn.Plan_start_dt as number_of_days from ...

If the dates include a time fraction you might need to truncate them:

select trunc(Sopn.Pln_due_dt) - trunc(Sopn.Plan_start_dt) as number_of_days from ...
 
Back
Top