Oracle PL/SQL ORA-00947 Not Enough Values Error

In Oracle database, the following error message may appear when an incorrect SQL statement is used, in SQL Plus or in anywhere that send SQL queries to the databases such as stored procedure or external programs.

PL/SQL: SQL Statement ignored
PL/SQL: ORA-00947: not enough values


The reason for ORA-00947 error is when a SQL statement requires two sets of value, i.e number of number of columns and its value that are specified in the SQL to be equal in number. But the second part of the query which is column values contains fewer items than the first part which is the number of columns. The error may happens in all kind of SQL statements - Insert, Update or Select - and it can also occur in a WHERE or HAVING clause in which a nested sub-SELECT returns too few columns. If the SQL does not specify columns, it means that the values entered are less that the columns existed in the table in database.

For example, the ORA-00947 error will be returned if you try to execute the following SQL statements:

INSERT INTO Customers (Customer_ID, Customer_Name, Birthday) VALUES (’1′, ‘My Customer’);

or

SELECT * FROM Customers WHERE (Customer_ID, Customer_Name) IN (SELECT Customer_ID FROM Orders);

To solve the error and correct the problem, check that the number of values provided in the column values part is equal that the columns specified, or the number of columns in table, and change the SQL statement to make them equal.

You can either reduce the number of columns, or increase the number of values provided to the column to make the SQL statement equaled. This applies to the nested SQL statements with HAVING or WHERE clause too. For example, the correct SQL statements should be like the following:

INSERT INTO Customers (Customer_ID, Customer_Name, Birthday) VALUES (’1′, ‘My Customer’, ‘08/08/1988′);

or

INSERT INTO Customers (Customer_ID, Customer_Name) VALUES (’1′, ‘My Customer’);

or

SELECT * FROM Customers WHERE (Customer_ID, Customer_Name) IN (SELECT Customer_ID, Customer_Name FROM Orders);

or

SELECT * FROM Customers WHERE (Customer_ID) IN (SELECT Customer_ID FROM Orders);

Share and contribute or get technical support and help at My Digital Life Forums.



Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

ORA-00947 - ORA-00947: not enough values - PL/SQL: ORA-00947: not enough values - not enough values - ORA 00947 - oracle not enough values - PL/SQL: ORA-00947 - oracle ORA-00947: not enough values - cause a time delay in an oracle insert - not enough value Oracle - PLS-00947 - PL/SQL: ORA-00947: not enough values - sql not enough values - SQL Error: ORA-00947 - ora-00947 not enough values - PLSQL PL/SQL: ORA-00947: not enough values - PL/SQL: SQL Statement ignored - "ORA-00947: not enough values" - SQL Error: ORA-00947: not enough values - oracle "not enough values" - pls 00947 - ORA-00947: not enough values in oracle - ora-00947 insert - find error value with ORA in oracle - not enough values - inserting only few values in the table pl/sql - oracle pl/sql error - PL/SQL: ORA-00947: not enough values in oracle - SQL Error ORA-00947 - no enough values in oracle - error 3114 create new item oracle - not enough values error - sql "not enough values" - "PL/SQL: ORA-00947: not enough values" - ORA-00947: not enough values - 00947 - NOT ENOUGH VALUES SQL - oracle pl/sql on serbian - select in PL/SQL INSERT into table values - Not enough values Oracle error - ORACLE INSERT INTO SELECT not enough values - Error(113,43): PL/SQL: ORA-00947: not enough values - error not enough values - oracle pl/sql error checking - oracle error not enough values - enter value for + oracle pl/sql error - Oracle "PL/SQL" "@SQLStatement" - ORA-00947: Niet genoeg waarden - ORA-00947: not enough values shutdown - oracle pl/sql free video -