Solved

Syntax for How to Search Between Dates in Oracle

Posted on 2011-09-23
2
534 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
database upgrade 8 77
SQL query question 8 78
Multiple MSSQL instances on same server 4 41
Simple SQL query from two tables 13 54
This article describes some very basic things about SQL Server filegroups.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

809 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