August 2002
Intermediate to advanced
528 pages
10h 12m
English
The TRUNC function is used to truncate or trim values to a specified precision. The function contains two parameters: the target column or value and the specified precision. Specifying a precision of 2 will cause the value to be truncated following the hundredths. A precision of –2 will cause the value to be truncated following the hundred. Listing 7.5 illustrates a query that uses the TRUNC function. Compare the results of this query to the values in Listing 7.4.
SQL> select last_name, wages/3, trunc(wages/3,2), trunc(wages/3,-2) 2 from employee 3 where fk_department='INT' 4 group by last_name, wages; LAST_NAME WAGES/3 TRUNC(WAGES/3,2) TRUNC(WAGES/3,-2) --------------- --------- ---------------- ... |