SQL TRUNC Function: Usage Guide

The TRUNC function in SQL is used to truncate the decimal part of a numeric value and return the result with the specified precision. Its basic syntax is as follows:

TRUNC(number, precision)

In this case, “number” refers to the numerical value to truncate the decimal part, and “precision” specifies the accuracy, meaning the number of decimal places to retain. For example, if you want to truncate a numerical value to two decimal places, you can use the following statement:

SELECT TRUNC(123.4567, 2);

This statement will return a result of 123.45, truncating the decimal portion of 123.4567 to 2 decimal places.

bannerAds