• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 560
  • Last Modified:

Syntax for How to Search Between Dates in Oracle

I am attempting to query an Oracle database, and I am new to Oracle syntax. (I am used to MS SQL Server and the local functions for that DBMS.) When I am attempting to search for all transactions that occurred between the dates of 9/1/2011 and 9/5/2011, I am ending up with the error message:
"SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"

The SQL code that I am attempting to use is listed below:
"Select * From results r Where r.txn_date BETWEEN todate('09/01/2011','mm/dd/yyyy') AND todate('09/05/2011','mm/dd/yyyy')"

Any help that could be provided would be greatly appreciated.
  • 2
1 Solution
Devinder Singh VirdiLead Oracle DBA TeamCommented:
Please correct todate () into to_date()
Devinder Singh VirdiLead Oracle DBA TeamCommented:
Here is the corrected one:-

Select * From results r Where r.txn_date BETWEEN to_date('09/01/2011','mm/dd/yyyy') AND
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now