Preamble
The Oracle/PLSQL TRUNC function returns a number truncated to a certain number of digits after the decimal point.
Oracle/PLSQL syntax of TRUNC function
TRUNC( number_id, [ decimal_places_id ] ) )
Parameters and function arguments
- number_id – number for truncation.
- decimal_places_id – is the number of decimal digits for truncation. This value must be an integer number. If this parameter is not specified, the TRUNC function will return an integer number. If the parameter is negative, the numbers to the left of the decimal point will be truncated.
The TRUNC function (for numbers) returns a numerical value.
The TRUNC function can be used in the following versions of Oracle/PLSQL
|
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
|
Let’s consider some examples of the TRUNC function and learn how to use the TRUNC function in Oracle/PLSQL.
SELECT TRUNC(123.456) FROM DUAL;
--Result: 123
SELECT TRUNC(123.456, 0) FROM DUAL;
--Result: 123
SELECT TRUNC(123.456, 1) FROM DUAL;
--Result: 123,4
SELECT TRUNC(123.456, 2) FROM DUAL;
--Result: 123,45
SELECT TRUNC(123.456, 3) FROM DUAL;
--Result: 123,456
SELECT TRUNC(-123.456, 2) FROM DUAL;
--Result: -123.45
SELECT TRUNC(123.456, -1) FROM DUAL;
--Result: 120
SELECT TRUNC(123.456, -2) FROM DUAL;
--Result: 100
SELECT TRUNC(123.456, -3) FROM DUAL;
--Result: 0
Oracle Tutorial; Date Functions ROUND and TRUNC
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
How Can Banks Prevent Database Bottlenecks in Real-Time Financial Transactions?
- 1 September 2026
- Database Performance Management
Banks can prevent database bottlenecks in banking by continuously monitoring SQL workloads, optimizing queries and indexes, detecting resource contention, analyzing transaction latency, and identifying anomalies before performance declines. Effective database performance monitoring for banks provides real-time workload visibility and faster root cause analysis. Enteros helps financial institutions identify database inefficiencies and maintain reliable, scalable transaction … Continue reading “How Can Banks Prevent Database Bottlenecks in Real-Time Financial Transactions?”
Why Is Database Observability Important for Modern Hospitals and Healthcare IT Teams?
Database observability in healthcare is important because hospitals depend on databases to power EHRs, patient portals, clinical applications, billing, analytics, and other essential systems. It gives healthcare IT teams deeper visibility into SQL workloads, resource usage, bottlenecks, and performance changes. Enteros supports this approach with database observability, AI-powered analysis, anomaly detection, and root cause analysis … Continue reading “Why Is Database Observability Important for Modern Hospitals and Healthcare IT Teams?”
How Can Healthcare Organizations Reduce Cloud Database Costs With AIOps and FinOps
Healthcare organizations can reduce cloud database costs by combining AIOps with FinOps to identify inefficient workloads, detect anomalies, rightsize resources, and connect database performance with infrastructure spending. Effective healthcare cloud database cost optimization focuses on eliminating waste without compromising reliability. Enteros supports this approach through database observability, AI-powered SQL analysis, root cause analysis, performance intelligence, … Continue reading “How Can Healthcare Organizations Reduce Cloud Database Costs With AIOps and FinOps”
What Database Performance Challenges Do Hospitals Face in Cloud-Based Healthcare Systems?
Hospitals face database performance challenges such as slow SQL queries, growing healthcare data, EHR performance issues, database bottlenecks, resource contention, cloud complexity, and rising costs. Cloud-based healthcare systems require continuous database monitoring, workload optimization, anomaly detection, and root-cause analysis. AI-powered AIOps can help hospitals improve database performance, reliability, scalability, and cloud cost efficiency while supporting … Continue reading “What Database Performance Challenges Do Hospitals Face in Cloud-Based Healthcare Systems?”