简体   繁体   中英

Oracle SQLDeveloper: How to use the 'Filter' toolbar item to query by date?

Having trouble finding documentation on the SqlDeveloper UI's "Filter" item, and what to input to filter by date. Version 4.1.5.21. I have tried entering the schema and table prefixes, but the result was the same. I also tried entering the full name of the month, but the result was the same (and putting the date in quotes, using the to_date() function, omitting the semicolon -- all were unsuccessful).

Date_Question

Official documentation which covers this can be found in section 1.6 of the Oracle SQL Developer 4.1 User Guide located at https://docs.oracle.com/cd/E39885_01/appdev.40/e38414/intro.htm#RPTUG10500 .

In summary the filter box acts as a WHERE clause on the data in the table, valid predicates can be entered, the text 'WHERE' and suffixed semi-colon are not required.

If the column you are querying (MY_COLUMN) has a data type of DATE then each value will also contain a time which must be taken into consideration. Using an equals operator will only return records with a time of 00:00:00 for the given date.

For example to return all records for the date 17-JUN-2017:

MY_COLUMN >= TO_DATE('2017-06-17', 'YYYY-MM-DD') AND MY_COLUMN < TO_DATE('2017-06-18', 'YYYY-MM-DD')

Tested and confirmed working on columns with data types DATE and TIMESTAMP in Oracle SQL Developer v4.1.5.21.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM