Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-28 · container image gvenzl/oracle-free:23-slim
ORA-01428 means a math function got an argument it can't calculate with. In 23ai the message includes the offending value, for example Argument 0 is out of range., which tells you which row's value broke the query.
All three common cases were reproduced and fixed below.
01LN of a zero value
ROUND(LN(amount), 4) over daily sales failed with ORA-01428: Argument 0 is out of range. The logarithm is only defined for numbers greater than 0, and one day had amount 0.
WHERE amount <= 0 found that row (sale_day 2). With CASE WHEN amount > 0 THEN ROUND(LN(amount), 4) END, the query returned 7.0901 and 8.1315, and NULL for day 2.
Setup
CREATE TABLE daily_sales (sale_day NUMBER PRIMARY KEY, amount NUMBER);
INSERT INTO daily_sales VALUES (1, 1200);
INSERT INTO daily_sales VALUES (2, 0);
INSERT INTO daily_sales VALUES (3, 3400);
COMMIT;Table created.
1 row created.
1 row created.
1 row created.
Commit complete.SELECT sale_day, ROUND(LN(amount), 4) AS ln_amount FROM daily_sales ORDER BY sale_day;SELECT sale_day, ROUND(LN(amount), 4) AS ln_amount FROM daily_sales ORDER BY sale_day
*
ERROR at line 1:
ORA-01428: Argument 0 is out of range.
Help: https://docs.oracle.com/error-help/db/ora-01428/SELECT sale_day, amount FROM daily_sales WHERE amount <= 0; SALE_DAY AMOUNT
---------- ----------
2 0
1 row selected.Decide what a zero day should show. CASE without ELSE returns NULL; add ELSE if you need another value.
SELECT sale_day, CASE WHEN amount > 0 THEN ROUND(LN(amount), 4) END AS ln_amount FROM daily_sales ORDER BY sale_day; SALE_DAY LN_AMOUNT
---------- ----------
1 7.0901
2
3 8.1315
3 rows selected.02ACOS argument slightly above 1 in a distance formula
A distance query using the spherical law of cosines (ACOS(SIN*SIN + COS*COS*COS)) failed with Argument 1.00000000000000000000000000000000000001 is out of range. when a store was compared with itself.
Computing the inner value minus 1 showed 1.0000E-38 for the same store: rounding pushed it just over 1, the upper limit of ACOS. Clamping with ACOS(LEAST(1, GREATEST(-1, ...))) returned 0 km for the same store and 325.1 km for the other one.
Setup
CREATE TABLE stores (store_id NUMBER PRIMARY KEY, lat NUMBER, lon NUMBER);
INSERT INTO stores VALUES (1, 37.5665, 126.9780);
INSERT INTO stores VALUES (2, 35.1796, 129.0756);
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.SELECT b.store_id, ROUND(6371 * ACOS(SIN(a.lat * ACOS(-1) / 180) * SIN(b.lat * ACOS(-1) / 180) + COS(a.lat * ACOS(-1) / 180) * COS(b.lat * ACOS(-1) / 180) * COS((b.lon - a.lon) * ACOS(-1) / 180)), 1) AS km FROM stores a, stores b WHERE a.store_id = 1 ORDER BY b.store_id;SELECT b.store_id, ROUND(6371 * ACOS(SIN(a.lat * ACOS(-1) / 180) * SIN(b.lat * ACOS(-1) / 180) + COS(a.lat * ACOS(-1) / 180) * COS(b.lat * ACOS(-1) / 180) * COS((b.lon - a.lon) * ACOS(-1) / 180)), 1) AS km FROM stores a, stores b WHERE a.store_id = 1 ORDER BY b.store_id
*
ERROR at line 1:
ORA-01428: Argument 1.00000000000000000000000000000000000001 is out of range.
Help: https://docs.oracle.com/error-help/db/ora-01428/SELECT b.store_id, SIN(a.lat * ACOS(-1) / 180) * SIN(b.lat * ACOS(-1) / 180) + COS(a.lat * ACOS(-1) / 180) * COS(b.lat * ACOS(-1) / 180) * COS((b.lon - a.lon) * ACOS(-1) / 180) - 1 AS over_one FROM stores a, stores b WHERE a.store_id = 1 ORDER BY b.store_id; STORE_ID OVER_ONE
---------- ----------
1 1.0000E-38
2 -.00130174
2 rows selected.This only shows up for identical or very close points, so it can pass testing and fail later. Clamp the value before ACOS.
SELECT b.store_id, ROUND(6371 * ACOS(LEAST(1, GREATEST(-1, SIN(a.lat * ACOS(-1) / 180) * SIN(b.lat * ACOS(-1) / 180) + COS(a.lat * ACOS(-1) / 180) * COS(b.lat * ACOS(-1) / 180) * COS((b.lon - a.lon) * ACOS(-1) / 180)))), 1) AS km FROM stores a, stores b WHERE a.store_id = 1 ORDER BY b.store_id; STORE_ID KM
---------- ----------
1 0
2 325.1
2 rows selected.03POWER of a negative number with a fractional exponent
A 3-year growth rate POWER(profit_2026 / profit_2023, 1/3) failed with Argument -.5 is out of range. A branch went from a profit of 1000 to a loss of -500, so the ratio was -0.5, and a negative number can't be raised to a fractional power.
Checking ratios <= 0 found branch 2. With CASE WHEN profit_2026 / profit_2023 > 0 THEN ... END, branch 1 returned 10 (%) and branch 2 returned NULL.
Setup
CREATE TABLE branch_profit (branch_id NUMBER PRIMARY KEY, profit_2023 NUMBER, profit_2026 NUMBER);
INSERT INTO branch_profit VALUES (1, 1000, 1331);
INSERT INTO branch_profit VALUES (2, 1000, -500);
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.SELECT branch_id, ROUND((POWER(profit_2026 / profit_2023, 1/3) - 1) * 100, 1) AS cagr_pct FROM branch_profit ORDER BY branch_id;SELECT branch_id, ROUND((POWER(profit_2026 / profit_2023, 1/3) - 1) * 100, 1) AS cagr_pct FROM branch_profit ORDER BY branch_id
*
ERROR at line 1:
ORA-01428: Argument -.5 is out of range.
Help: https://docs.oracle.com/error-help/db/ora-01428/SELECT branch_id, profit_2026 / profit_2023 AS ratio FROM branch_profit WHERE profit_2026 / profit_2023 <= 0; BRANCH_ID RATIO
---------- ----------
2 -.5
1 row selected.A growth rate isn't meaningful when the sign changes. Show those rows separately instead of forcing a number.
SELECT branch_id, CASE WHEN profit_2026 / profit_2023 > 0 THEN ROUND((POWER(profit_2026 / profit_2023, 1/3) - 1) * 100, 1) END AS cagr_pct FROM branch_profit ORDER BY branch_id; BRANCH_ID CAGR_PCT
---------- ----------
1 10
2
2 rows selected.FAQ
What does ORA-01428 argument is out of range mean?
A math function such as LN, LOG, ACOS, ASIN, SQRT or POWER received a value it can't compute. The message shows the value, which helps find the row.
How do I avoid ORA-01428 with LN or LOG on zero?
Only compute for positive values: CASE WHEN x > 0 THEN LN(x) END. Rows with 0 or less return NULL.
Why does my ACOS distance query fail for the same location?
Rounding can make the inner value slightly larger than 1. Wrap it: ACOS(LEAST(1, GREATEST(-1, expr))).
Why does POWER(-0.5, 1/3) give ORA-01428?
Oracle's POWER doesn't accept a negative base with a non-integer exponent. Filter those rows first with CASE.
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0