Question

Every time I run this query, I'm getting ora-00907 error:

ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis"

SELECT COUNT(*) 
  FROM jobseekerprofile
  JOIN userprofile on jobseekerprofile.portalprofileid = userprofile.portalprofileid
WHERE TO_CHAR((jobseekerprofile.createddate >= '23-APR-2013'),
      TO_CHAR(jobseekerprofile.createddate >='23-APR-2013 14:00:00')) 
  AND TO_CHAR((jobseekerprofile.createddate < '24-APR-2013'),
      TO_CHAR(jobseekerprofile.createddate < '24-APR-2013 13:59:00')) 
  AND userprofile.domainid = 1
Was it helpful?

Solution

"i need the records to have date with timestamp"

Dates have time elements; there always taken into consideration when comparing two dates. So your second comparison will reject any value of 24-APR-2013 which occurs after midnight. So you definitely need to correct that.

You may have another problem because you are casting dates to strings. Strings have different comparison algorithms. Instead you should be casting strings to dates.

where createddate between to_date('23-APR-2013 14:00:00', 'DD-MON-YYYY HH24:MI:SS' 
                  and to_date('24-APR-2013 13:59:00', 'DD-MON-YYYY HH24:MI:SS')

Might as well use BETWEEN to simplify the statement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top