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

PL/SQL: ORA-00947: not enough values - ora-00947 - ORA-00947: not enough values - not enough values - oracle not enough values - PL/SQL: SQL statement ignored - PL/SQL: ORA-00947: not enough values - oracle sql not in - pl/sql statement ignored - sql insert not enough values - oracle select not number - all - ora-00947 not enough values - insert into + values + plsql - not in sql oracle - ORA-00947: insert into - PL/SQL: ORA-00947: not enough values + pl sql - select into ora 00947 - Insert statement PL/SQL: ORA-00947: not enough values - nested sub-select oracle - oracle error : not enough value - sql STATEMENT IGNORED ORACLE - SQL select not numbers - sql not in - sql error -942 oracle - sql ORA-00947: not enough values - "ora-00947: not enough values" - ora-00947 insert - orcale ORA-00947 - pl/sql ORA-00947 insert into select - SQL NOT ENOUGH VALUE - SQL Error: ORA-00947: not enough values - INSERT INTO SELECT +PL/SQL - not enough values ORA-00947: not enough values - not enough values in sql - not enough values+sql - oracle not enough values error - oracle "PL/SQL: Statement ignored" - oracle pl sql checking equals - pl/sql : ora-00947 - PL/SQL not enough values - PL/SQL ORA-00947 - pls-00947 - SQL IN number of values - ora 00947 - oracle sql From "sub Select" - error : not enough values on Oracle 8i - not in no plsql - Oracle, reduce the number of columns - ORA-00947: not enough values datetime -