A quick note about what the Oracle
TRUNC function can do:
If you have a table
ORDERS with a date field
DATE_CREATION and you want to filter the records with a given date, you can use the
SELECT ID FROM ORDERS WHERE TRUNC(ORDERS.DATE_CREATION) = TO_DATE('27/01/2014', 'DD/MM/YYYY')
This will truncate the time from the
DATE_CREATION and leave out only the date.
The full syntax for TRUNC is:
TRUNC ( date, [ format ] )
date is the date to truncate.
format is the unit of measure to apply for truncating. If the format parameter is omitted, the TRUNC function will truncate the date to the day value, so that any hours, minutes, or seconds will be truncated off.
Update, 28/feb/2014: Another Oracle goodie – how to find out details about sequences:
select sequence_owner, sequence_name, min_value, max_value, last_number from all_sequences order by sequence_owner, sequence_name;
Written by Dorin Moise (Published articles: 260)