I'm designing a query using Brio Business Intelligence software, and I'm attempting to formulate some type of function to calculate business days between two dates (excluding Saturdays and Sundays, don't care about holidays). The database which is being worked with is Oracle and I've found many different Oracle functions that do this, but everytime I plug it into Brio, it never works! Always get some error message (ORACLE 936: missing expression is the most common). Can anyone tell me what I'm doing wrong? Thanks in advance.

SELECT count(1) thecount
FROM yourtable
-- the day of week number of Saturday and Sunday change
-- depending on your NLS settings
WHERE TO_CHAR(yourdate,'D') NOT IN ('7','1')
AND yourdate BETWEEN startdate AND enddate
AND ...