Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-12-01 · container image gvenzl/oracle-free:23-slim
ORA-00913 means Oracle received more values than it can use. In an INSERT, the number of values is larger than the number of target columns. In a WHERE condition, a subquery returns more columns than the left side it is compared with.
Count the columns on both sides. In the lab the causes were extra values in VALUES, INSERT ... SELECT * from a table with more columns, an IN subquery that selected 2 columns, an UPDATE ... SET col = (SELECT a, b ...), and a number written with thousands separators (1,250,000) in VALUES.
01VALUES has more values than the column list
INSERT INTO orders (order_id, cust_name) VALUES (1, 'Kim', 'NEW'); lists 2 columns but gives 3 values, so it failed with ORA-00913. The table itself has 3 columns (ORDER_ID, CUST_NAME, STATUS); the column list just left one out.
Adding status to the column list inserted the row 1 Kim NEW.
Setup
CREATE TABLE orders (order_id NUMBER, cust_name VARCHAR2(20), status VARCHAR2(10));Table created.INSERT INTO orders (order_id, cust_name) VALUES (1, 'Kim', 'NEW');INSERT INTO orders (order_id, cust_name) VALUES (1, 'Kim', 'NEW')
*
ERROR at line 1:
ORA-00913: too many values
Help: https://docs.oracle.com/error-help/db/ora-00913/SELECT column_name FROM user_tab_columns WHERE table_name = 'ORDERS' ORDER BY column_id;COLUMN_NAME
------------------------------
ORDER_ID
CUST_NAME
STATUS
3 rows selected.The table has three columns: ORDER_ID, CUST_NAME, STATUS. The INSERT column list left out STATUS, so it did not match the three values.
Add the missing column to the list, or remove the extra value.
INSERT INTO orders (order_id, cust_name, status) VALUES (1, 'Kim', 'NEW');
SELECT order_id, cust_name, status FROM orders;1 row created.
ORDER_ID CUST_NAME STATUS
---------- -------------------- ------------------------------
1 Kim NEW
1 row selected.02INSERT ... SELECT * returns more columns than the target table
INSERT INTO orders SELECT * FROM orders_stage; failed. Counting the columns showed ORDERS has 2 and ORDERS_STAGE has 3 (it has an extra loaded_at column).
Selecting only the needed columns, INSERT INTO orders (order_id, cust_name) SELECT order_id, cust_name FROM orders_stage;, created 2 rows.
Setup
CREATE TABLE orders (order_id NUMBER, cust_name VARCHAR2(20));
CREATE TABLE orders_stage (order_id NUMBER, cust_name VARCHAR2(20), loaded_at DATE);
INSERT INTO orders_stage VALUES (10, 'Lee', SYSDATE);
INSERT INTO orders_stage VALUES (11, 'Park', SYSDATE);
COMMIT;Table created.
Table created.
1 row created.
1 row created.
Commit complete.INSERT INTO orders SELECT * FROM orders_stage;INSERT INTO orders SELECT * FROM orders_stage
*
ERROR at line 1:
ORA-00913: too many values
Help: https://docs.oracle.com/error-help/db/ora-00913/SELECT table_name, COUNT(*) AS cols FROM user_tab_columns WHERE table_name IN ('ORDERS', 'ORDERS_STAGE') GROUP BY table_name ORDER BY table_name;TABLE_NAME COLS
------------------------------ ----------
ORDERS 2
ORDERS_STAGE 3
2 rows selected.ORDERS has 2 columns and ORDERS_STAGE has 3. SELECT * passed one column too many.
Avoid SELECT * in INSERT ... SELECT. List the columns you want to copy.
INSERT INTO orders (order_id, cust_name)
SELECT order_id, cust_name FROM orders_stage;
SELECT order_id, cust_name FROM orders ORDER BY order_id;2 rows created.
ORDER_ID CUST_NAME
---------- --------------------
10 Lee
11 Park
2 rows selected.03An IN subquery returns two columns for one column
WHERE cust_id IN (SELECT cust_id, cust_name FROM customers WHERE grade = 'VIP') failed with ORA-00913. The left side is one column, cust_id, but the subquery returns two.
Leaving only cust_id in the subquery's SELECT made the query work, and it returned order 100.
Setup
CREATE TABLE orders (order_id NUMBER, cust_id NUMBER);
CREATE TABLE customers (cust_id NUMBER, cust_name VARCHAR2(20), grade VARCHAR2(5));
INSERT INTO customers VALUES (1, 'Kim', 'VIP');
INSERT INTO customers VALUES (2, 'Lee', 'GEN');
INSERT INTO orders VALUES (100, 1);
INSERT INTO orders VALUES (101, 2);
COMMIT;Table created.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
Commit complete.SELECT order_id FROM orders WHERE cust_id IN (SELECT cust_id, cust_name FROM customers WHERE grade = 'VIP');SELECT order_id FROM orders WHERE cust_id IN (SELECT cust_id, cust_name FROM customers WHERE grade = 'VIP')
*
ERROR at line 1:
ORA-00913: too many values
Help: https://docs.oracle.com/error-help/db/ora-00913/SELECT cust_id, cust_name FROM customers WHERE grade = 'VIP'; CUST_ID CUST_NAME
---------- --------------------
1 Kim
1 row selected.Run alone, the subquery returns two columns, CUST_ID and CUST_NAME. That cannot be compared with the single cust_id on the left.
The subquery in col IN (...) must return one column. To compare two columns, write both on the left: (a, b) IN (SELECT a, b ...).
SELECT order_id FROM orders WHERE cust_id IN (SELECT cust_id FROM customers WHERE grade = 'VIP'); ORDER_ID
----------
100
1 row selected.04UPDATE SET one column = a subquery that selects two columns
Customer data was copied from a master table with SET c.cust_name = (SELECT m.cust_name, m.grade ...). One column was on the left and the subquery returned two columns, so the UPDATE failed with ORA-00913 and the * pointed at the subquery.
The master table had both values (Kim Minsu VIP, Lee Jiwon GEN). Listing both columns on the left, SET (c.cust_name, c.grade) = (SELECT m.cust_name, m.grade ...), updated 2 rows with both columns.
Setup
CREATE TABLE customers (cust_id NUMBER PRIMARY KEY, cust_name VARCHAR2(20), grade VARCHAR2(5));
CREATE TABLE cust_master (cust_id NUMBER PRIMARY KEY, cust_name VARCHAR2(20), grade VARCHAR2(5));
INSERT INTO customers VALUES (1, 'Kim', 'GEN');
INSERT INTO customers VALUES (2, 'Lee', 'GEN');
INSERT INTO cust_master VALUES (1, 'Kim Minsu', 'VIP');
INSERT INTO cust_master VALUES (2, 'Lee Jiwon', 'GEN');
COMMIT;Table created.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
Commit complete.UPDATE customers c
SET c.cust_name = (SELECT m.cust_name, m.grade FROM cust_master m WHERE m.cust_id = c.cust_id); SET c.cust_name = (SELECT m.cust_name, m.grade FROM cust_master m WHERE m.cust_id = c.cust_id)
*
ERROR at line 2:
ORA-00913: too many values
Help: https://docs.oracle.com/error-help/db/ora-00913/SELECT m.cust_id, m.cust_name, m.grade FROM cust_master m ORDER BY m.cust_id; CUST_ID CUST_NAME GRADE
---------- -------------------- -----
1 Kim Minsu VIP
2 Lee Jiwon GEN
2 rows selected.The master table has both values the subquery picks, CUST_NAME and GRADE. The left side names only cust_name, so the counts differ.
Match the column count on both sides of SET. To copy several columns at once, put them in parentheses on the left: SET (a, b) = (SELECT x, y ...).
UPDATE customers c
SET (c.cust_name, c.grade) = (SELECT m.cust_name, m.grade FROM cust_master m WHERE m.cust_id = c.cust_id);
SELECT cust_id, cust_name, grade FROM customers ORDER BY cust_id;
COMMIT;2 rows updated.
CUST_ID CUST_NAME GRADE
---------- -------------------- -----
1 Kim Minsu VIP
2 Lee Jiwon GEN
2 rows selected.
Commit complete.05PL/SQL SELECT INTO has more variables than selected columns
SELECT name INTO v_name, v_sal FROM emp selects one column but gives two variables, so PL/SQL reports ORA-06550 with PL/SQL: ORA-00913: too many values. This often happens when a column is removed from the SELECT but its variable is left in INTO.
Make the lists match: SELECT name, sal INTO v_name, v_sal printed KIM 500.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, name VARCHAR2(10), sal NUMBER);
INSERT INTO emp VALUES (1, 'KIM', 500);
COMMIT;Table created.
1 row created.
Commit complete.SET SERVEROUTPUT ON
DECLARE
v_name emp.name%TYPE;
v_sal emp.sal%TYPE;
BEGIN
SELECT name INTO v_name, v_sal FROM emp WHERE emp_id = 1;
DBMS_OUTPUT.PUT_LINE(v_name || ' ' || v_sal);
END;
/ SELECT name INTO v_name, v_sal FROM emp WHERE emp_id = 1;
*
ERROR at line 5:
ORA-06550: line 5, column 34:
PL/SQL: ORA-00913: too many values
ORA-06550: line 5, column 3:
PL/SQL: SQL Statement ignored
Help: https://docs.oracle.com/error-help/db/ora-06550/SELECT name, sal FROM emp WHERE emp_id = 1;NAME SAL
------------------------------ ----------
KIM 500
1 row selected.The variables v_name and v_sal need two columns, NAME and SAL. The SELECT listed only name.
SET SERVEROUTPUT ON
DECLARE
v_name emp.name%TYPE;
v_sal emp.sal%TYPE;
BEGIN
SELECT name, sal INTO v_name, v_sal FROM emp WHERE emp_id = 1;
DBMS_OUTPUT.PUT_LINE(v_name || ' ' || v_sal);
END;
/KIM 500
PL/SQL procedure successfully completed.06A number with thousands separators in VALUES (1,250,000)
The amount was copied from a report as 1,250,000 and pasted into VALUES (1, 'KIM', 1,250,000). SQL reads every comma as a value separator, so the INSERT had 5 values (1, 'KIM', 1, 250, 000) for 3 columns and failed with ORA-00913.
TO_NUMBER('1,250,000', '9G999G999', ...) returned 1250000. Writing the literal without commas, 1250000, created the row.
Setup
CREATE TABLE payments (pay_id NUMBER PRIMARY KEY, cust_name VARCHAR2(20), amount NUMBER);Table created.INSERT INTO payments (pay_id, cust_name, amount) VALUES (1, 'KIM', 1,250,000);INSERT INTO payments (pay_id, cust_name, amount) VALUES (1, 'KIM', 1,250,000)
*
ERROR at line 1:
ORA-00913: too many values
Help: https://docs.oracle.com/error-help/db/ora-00913/SELECT TO_NUMBER('1,250,000', '9G999G999', 'NLS_NUMERIC_CHARACTERS=''.,''') AS amount FROM dual; AMOUNT
----------
1250000
1 row selected.Write number literals without grouping separators. If the value arrives as text with commas, quote it and convert with TO_NUMBER and a format model.
INSERT INTO payments (pay_id, cust_name, amount) VALUES (1, 'KIM', 1250000);
SELECT pay_id, cust_name, amount FROM payments;1 row created.
PAY_ID CUST_NAME AMOUNT
---------- -------------------- ----------
1 KIM 1250000
1 row selected.FAQ
What does ORA-00913 too many values mean?
Oracle got more values than target columns. In an INSERT there are more values than columns; in a condition, a subquery returns more columns than the left side.
Why do I get ORA-00913 in INSERT INTO ... SELECT?
The SELECT returns more columns than the table, often because of SELECT * from a table with extra columns. List only the columns you need.
Why does my subquery give ORA-00913?
A subquery used with IN or = against one column selects two or more columns. Keep only the column being compared.
Why does UPDATE ... SET col = (SELECT ...) give ORA-00913?
The subquery selects more columns than the left side of SET. Select one column, or update several columns together with SET (col1, col2) = (SELECT x, y ...).
What is the difference between ORA-00913 and ORA-00947?
ORA-00913 means too many values, ORA-00947 means not enough. Both are fixed by making the column count and the value count the same.
Why do I get PL/SQL: ORA-00913 in SELECT INTO?
The INTO list has more variables than the SELECT list has columns. Remove the extra variable or select the missing column.
Why does INSERT give ORA-00913 when the column count looks right?
Check numbers with commas. 1,250,000 without quotes is three values, not one. In the lab VALUES (1, 'KIM', 1,250,000) failed and 1250000 worked.
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