Oracle comparing timestamp with date

后端 未结 3 661
抹茶落季
抹茶落季 2020-12-29 03:31

I have a timestamp field and I just want to compare the date part of it in my query in Oracle

How do I do that,

SELECT *
FROM Table1
WHERE date(field         


        
3条回答
  •  梦毁少年i
    2020-12-29 04:20

    You can truncate the date

    SELECT *
    FROM Table1
    WHERE trunc(field1) = to_Date('2012-01-01','YYY-MM-DD')
    

    Look at the SQL Fiddle for more examples.

提交回复
热议问题