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
有帮助吗?

解决方案

"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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top