Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to compare date?

287951Jun 6 2002
Hi, all, I tried to compare two dates and get the difference of the days less than 30 but it didn't work . Here's my code:
select c.inst_seq_num, avg(c.dlt_egt) as a from EHM_CMPRDLT c where c.inst_seq_num='#inst_seq_num[CurrentRow]#' and datediff(dd, c.end_dt,'#end_dt[CurrentRow]#')<30 group by c.inst_seq_num

I set up oracle database as ODBC, and write the code in coldfusion.
following is the error message:
ODBC Error Code = S0022 (Column not found)

[Microsoft][ODBC driver for Oracle][Oracle]ORA-00904: invalid column name

SQL = "select c.inst_seq_num, avg(c.dlt_egt) as a from EHM_CMPRDLT c where c.inst_seq_num='22' and datediff(dd, c.end_dt,'1996-04-06 16:29:00')<30 group by c.inst_seq_num"

Data Source = "ORACLE_EPRNET"

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (40:1) to (40:73).

Any suggestions? Thanks a lot!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2002
Added on Jun 6 2002
4 comments
343 views