KB · Oracle Database · Script

"ORA-01438: value larger than specified precision": the largest value NUMBER(p) accepts

Oracle Database · Script · Verified on Oracle 11.2 and 23ai · Updated 2026-12-03

Error this answers

  • ORA-01438: value larger than specified precision allowed for this column

NUMBER(p) holds at most p digits, so the largest value is p nines. When an insert fails with ORA-01438, or a sequence is creeping toward a column's limit, this prints that maximum so you don't have to count nines.

Usage

SQL> @pmx.sql 10
 9999999999
pmx.sqlMIT · Download ·
-- pmx.sql: the largest value a NUMBER(p) column accepts
-- Copyright (c) HASHJOIN. MIT License (https://hashjoin.com/kb/license/)
-- https://hashjoin.com/kb/oracle/number-precision-max-value/
--
-- Usage: @pmx.sql <precision>
--        @pmx.sql 10     9999999999

col max_value format 999999999999999999999999999999999999999999999999999999999


select to_number(rpad('1',&&1+1,'0'))-1 max_value from dual
/

curl -O https://hashjoin.com/kb/oracle/number-precision-max-value/pmx.sql

Gotchas

Tired of fixing the same thing twice?

HASHJOIN turns the checks and fixes your on-call runs by hand into tooling that gives the same answer every time. Fixed scope, and you own all of the code.