0

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
4

1 回答 1

1

“我需要记录带有时间戳的日期”

日期有时间元素;比较两个日期时总是考虑到这一点。因此,您的第二次比较将拒绝午夜后发生的 24-APR-2013 的任何值。所以你肯定需要纠正它。

您可能还有另一个问题,因为您将日期转换为字符串。字符串有不同的比较算法。相反,您应该将字符串转换为日期。

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')

不妨使用 BETWEEN 来简化语句。

于 2013-04-26T05:15:06.617 回答