 |
|
Oracle trunc tips
Oracle Tips by Burleson Consulting |
As
with the numeric trunc function, the date version simply truncates
the date to the level specified in the format. The trunc function is often
used to “chop-off” unwanted parts of a date. IN the example, below we
use trunc to convert the data to the first day of the current month, and the
first day of the current year:
select
sysdate,
trunc(sysdate,'month') month,
trunc(sysdate,'year')
year
from
dual;
SYSDATE MONTH
YEAR
--------- --------- ---------
24-JAN-05 01-JAN-05 01-JAN-05
 |
If you like Oracle tuning, see the book "Oracle
Tuning: The Definitive Reference", with 950 pages of tuning tips and
scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |