for example, if you want to query the data after a certain day, you need to make the time field of the timestamp type accurate to the date before judging the query. I don"t know what is the common way to deal with this situation.
now two solutions have been found:
- to_char (sysdate,"yyyy-mm-dd") format the date;
- trunc (sysdate) to intercept;
catch a glimpse of it while searching, it is said:
to_char formats the date as a string, and if the previous date field has an index, the index is invalidated.
trunc seems to intercept to the most recent date, partially adding "00:00:00" to the time.
which of the two are commonly used in actual use, are there any specific advantages and disadvantages, or are there other better ways.