Quick Search:
 The Oracle TRUNC Function      [Return To Index] Jump to:  


The TRUNC function truncates either a number or a datetime value. The syntax of the TRUNC function is different depending on the whether it is being used for a number or a date and time value.

TRUNC (datetime)
The TRUNCATE (datetime) function returns date with the time portion of the day truncated to the unit specified by the format model.

TRUNC(datetime_exp, [fmt]);

The [fmt] parameter is the format that indicates how the date and time number should be truncated. If you omit fmt, then date is truncated to the nearest day.

When you specify a number as an argument, the TRUNCATE function truncates a number to a specified number of decimal places.

TRUNC (number, tvalue)

tvalue is an integer value that specifies the number of places to the right or left of the decimal point to which the number should be truncated. When the tvalue parameter is positive, digits to the right of the decimal point are truncated. When tvalue is negative the digits to the left of the decimal point are truncated. When the tvalue parameter is omitted, number is truncated to 0 decimal places.

Related Links:

Related Code Snippets:
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org