Solved

Syntax for How to Search Between Dates in Oracle

Posted on 2011-09-23
2
528 Views
Last Modified: 2012-05-12
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"
*Cause:    
*Action:"

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.
0
Comment
Question by:thenthorn1010
  • 2
2 Comments
 
LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 36588830
Please correct todate () into to_date()
0
 
LVL 15

Accepted Solution

by:
Devinder Singh Virdi earned 500 total points
ID: 36588836
Here is the corrected one:-

Select * From results r Where r.txn_date BETWEEN to_date('09/01/2011','mm/dd/yyyy') AND
to_date('09/05/2011','mm/dd/yyyy')
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now