DATEDIFF doesn't work

I want to have the number of days between two dates, so use the SQL function DATEDIFF(enddate, firstdate), but I get this error:

I tried DATEDIFF(d, enddate, firstdate) but I get the same error.

Thank you

Hi @Jhony
Post "Diagnostic Info" from Admin > Troubleshooting, and which database type you are querying.

Hi, I'll like to carry on from where this stopped.

I'm also having this issue where datediff doesn't seem to be working.
Here's the query I am trying to run on the Oracle Connection.

	a.shortdescription ,a.status	,a.amount	,a.frequency
	,a.duedate	,a.lastpaiddate	,a.company_id	,
	,a.collector_id	,a.startdate,a.registrationdate,a.nextdate,a.isactive,a.enddate	,a.bankstatus
	,a.funding_account_id	,substr(b.switch_id,1,3)fundingbank_id,d.description fundingbank,b.accountnumber fundingaccount,a.receiving_account_id,substr(c.switch_id,1,3)receivingbank_id
	,e.description receivingbank,c.accountnumber receivingaccount,a.mandateformid
	,to_char(a.startdate,'yyyy-mm-dd hh:mm:ss')start_date	,to_char(a.registrationdate,'yyyy-mm-dd hh:mm:ss')reg_date
	,to_char(a.enddate,'yyyy-mm-dd hh:mm:ss')end_date	,to_char(a.activationdate,'yyyy-mm-dd hh:mm:ss')activation_date
	specsremita.collection a
	specsremita.account b on
	specsremita.account c on
join d on,1,3)
join e on,1,3)
	specsremita.accountholder ah on ( = a.company_id)

I get the following error;

ORA-06553: PLS-306: wrong number or types of arguments in call to 'DATEDIFF'

The Start & End Dates have appropriate types assigned to them, so it shuold not be an issue of wrong type


@oaajibade When you are using SQL, then it doesn't matter what you do in Data Model, since Metabase just sends your query directly to your database. So try running the query directly on your database, then you would get the same error, meaning the error is coming from your database not Metabase.
Look in your database documentation or the internet:

In Oracle you just subtract one date from the other.