MATLAB: Does the SQL select statement, which includes a date range, not return data from Oracle when using the Database Toolbox

databaseDatabase Toolboxoracleselectstatementtoolbox

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.

Best Answer

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)