Oracle 23.26SQLLab-verified · 2026-11-29

ORA-00939: too many arguments for function

A function was called with more arguments than it accepts, often because a closing parenthesis is in the wrong place.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-00939: too many arguments for function

Jump to a cause

  1. 01The TO_CHAR format string ended up inside ROUND
  2. 02Several strings to remove were passed to one REPLACE
  3. 03SQL Server's ROUND(x, 0, 1) was used to truncate

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-29 · container image gvenzl/oracle-free:23-slim

ORA-00939 means a built-in function received more arguments than it allows. With nested functions, the extra argument usually belongs to the outer function and slipped inside the inner one because a parenthesis closed too late. It also happens with syntax carried over from other databases.

The * under the statement points at the function or the argument that is one too many.

01The TO_CHAR format string ended up inside ROUND

To show amounts with commas, the query was written as TO_CHAR(ROUND(amount, 2, 'FM999,999,990.00')). ROUND's parenthesis closes after the format, so ROUND gets three arguments. The * points at the format string.

ROUND(amount, 2) alone works (1234567.89, 980.5). Closing ROUND first, TO_CHAR(ROUND(amount, 2), 'FM999,999,990.00'), returns 1,234,567.89 and 980.50.

Setup
Setuprun as lab_a
CREATE TABLE sales (sale_id NUMBER PRIMARY KEY, amount NUMBER);
INSERT INTO sales VALUES (1, 1234567.891);
INSERT INTO sales VALUES (2, 980.5);
COMMIT;
OUTPUT
Table created.


1 row created.


1 row created.


Commit complete.
Reproducerun as lab_a
SELECT sale_id, TO_CHAR(ROUND(amount, 2, 'FM999,999,990.00')) AS amount_text FROM sales ORDER BY sale_id;
✕ ERROR
SELECT sale_id, TO_CHAR(ROUND(amount, 2, 'FM999,999,990.00')) AS amount_text FROM sales ORDER BY sale_id
                                         *
ERROR at line 1:
ORA-00939: too many arguments for function
Help: https://docs.oracle.com/error-help/db/ora-00939/
Checkrun as lab_a
SELECT sale_id, ROUND(amount, 2) AS rounded FROM sales ORDER BY sale_id;
OUTPUT
   SALE_ID    ROUNDED
---------- ----------
         1 1234567.89
         2      980.5

2 rows selected.
After the fixrun as lab_a
SELECT sale_id, TO_CHAR(ROUND(amount, 2), 'FM999,999,990.00') AS amount_text FROM sales ORDER BY sale_id;
✓ SUCCESS
   SALE_ID AMOUNT_TEXT
---------- ---------------
         1 1,234,567.89
         2 980.50

2 rows selected.

02Several strings to remove were passed to one REPLACE

To strip both hyphens and spaces from phone numbers, the query used REPLACE(phone, '-', '', ' '). REPLACE takes at most three arguments (string, search, replacement), so it cannot remove two different characters at once. The * points at REPLACE.

With two arguments, REPLACE(phone, '-') removes only the hyphens; 010 9876 5432 keeps its spaces. Nesting one REPLACE per character, REPLACE(REPLACE(phone, '-'), ' '), returns 01012345678 and 01098765432.

Setup
Setuprun as lab_a
CREATE TABLE customers (cust_id NUMBER PRIMARY KEY, phone VARCHAR2(20));
INSERT INTO customers VALUES (1, '010-1234-5678');
INSERT INTO customers VALUES (2, '010 9876 5432');
COMMIT;
OUTPUT
Table created.


1 row created.


1 row created.


Commit complete.
Reproducerun as lab_a
SELECT cust_id, REPLACE(phone, '-', '', ' ') AS digits FROM customers ORDER BY cust_id;
✕ ERROR
SELECT cust_id, REPLACE(phone, '-', '', ' ') AS digits FROM customers ORDER BY cust_id
                *
ERROR at line 1:
ORA-00939: too many arguments for function
Help: https://docs.oracle.com/error-help/db/ora-00939/
Checkrun as lab_a
SELECT cust_id, REPLACE(phone, '-') AS no_hyphen FROM customers ORDER BY cust_id;
OUTPUT
   CUST_ID NO_HYPHEN
---------- --------------------
         1 01012345678
         2 010 9876 5432

2 rows selected.
After the fixrun as lab_a
SELECT cust_id, REPLACE(REPLACE(phone, '-'), ' ') AS digits FROM customers ORDER BY cust_id;
✓ SUCCESS
   CUST_ID DIGITS
---------- --------------------
         1 01012345678
         2 01098765432

2 rows selected.

03SQL Server's ROUND(x, 0, 1) was used to truncate

In SQL Server, a third argument to ROUND truncates instead of rounding. Oracle's ROUND accepts only two arguments, so ROUND(price, 0, 1) fails and the * points at the 1.

The check shows the difference: ROUND(1999.99, 0) is 2000, TRUNC(1999.99, 0) is 1999. In Oracle, use TRUNC(price, 0) to cut off the decimals.

Setup
Setuprun as lab_a
CREATE TABLE products (product_id NUMBER PRIMARY KEY, price NUMBER);
INSERT INTO products VALUES (1, 1999.99);
INSERT INTO products VALUES (2, 450.4);
COMMIT;
OUTPUT
Table created.


1 row created.


1 row created.


Commit complete.
Reproducerun as lab_a
SELECT product_id, ROUND(price, 0, 1) AS price_floor FROM products ORDER BY product_id;
✕ ERROR
SELECT product_id, ROUND(price, 0, 1) AS price_floor FROM products ORDER BY product_id
                                   *
ERROR at line 1:
ORA-00939: too many arguments for function
Help: https://docs.oracle.com/error-help/db/ora-00939/
Checkrun as lab_a
SELECT product_id, price, ROUND(price, 0) AS rounded, TRUNC(price, 0) AS truncated FROM products ORDER BY product_id;
OUTPUT
PRODUCT_ID      PRICE    ROUNDED  TRUNCATED
---------- ---------- ---------- ----------
         1    1999.99       2000       1999
         2      450.4        450        450

2 rows selected.
After the fixrun as lab_a
SELECT product_id, TRUNC(price, 0) AS price_floor FROM products ORDER BY product_id;
✓ SUCCESS
PRODUCT_ID PRICE_FLOOR
---------- -----------
         1        1999
         2         450

2 rows selected.

FAQ

How do I fix ORA-00939 too many arguments for function?

Look at the * and count the arguments of that function between its own parentheses. In nested calls, an argument that belongs to the outer function has usually slipped inside the inner one; move the closing parenthesis.

How do I replace multiple characters with REPLACE in Oracle?

One REPLACE handles one search string. Nest them, for example REPLACE(REPLACE(phone, '-'), ' '). Passing extra strings to a single REPLACE gives ORA-00939.

Why does ROUND(x, 0, 1) fail in Oracle?

Oracle's ROUND takes a number and the number of decimal places only. The three-argument form is SQL Server syntax. Use TRUNC(x, 0) to truncate.

What is the difference between ORA-00939 and ORA-00938?

ORA-00939 is too many arguments, ORA-00938 is too few. A misplaced parenthesis in nested functions can cause either, depending on which function the argument moved into.

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