Why does my SQL select statement, which includes a date range, not return data from Oracle when using the Database Toolbox?

조회 수: 20 (최근 30일)
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.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 9월 28일
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개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by