Why does my SQL select statement, which includes a date range, not return data from Oracle when using the Database Toolbox?
2 views (last 30 days)
Show older comments
Why doesn't my select statement return data in Oracle with the Database Toolbox?
I am trying to constrain my data to be between certain dates. When I try my select statement, Oracle returns no data. For example:
sql='select DATE from TABLE where DATE between ''2001-06-28'' and ''2001-06-29'''
curs = exec(conn, sql)
curs=fetch(curs)
returns no data even if my data is between June 28th and June 29th.
Accepted Answer
MathWorks Support Team
on 28 Sep 2009
Oracle does not understand the date format you are using and decides that no data matches your SQL statement.
To get Oracle to understand the date, please change the date format to be DD-Month-YYYY. For example:
sql='select DATE from TABLE where DATE between ''28-Jun-2001'' and ''29-Jun-2001'''
curs = exec(conn, sql)
curs=fetch(curs)
0 Comments
More Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!