I am work on a project which has to add one column to the exist table. It is like this:
The OLD TBL Layout
OldTbl(
column1 number(1) not null,
column2 number(1) not null
);
SQL TO Create the New TBL
create table NewTbl(
column1 number(1) not null,
column2 number(1) not null,
**column3 number(1)**
);
When I try to insert the data by the SQL below, on one oracle server,it was successful executed, but on another oracle server, I got "ORA-00947 error: not enough values"
insert into NewTbl select
column1,
column2
from OldTbl;
Is there any oracle option may cause this kind of difference in oracle?
this is the error you received, which means, your table actually has more number of columns than you specified in the
INSERT
.Perhaps, you didn't add the column in either of the servers.
There is also a different syntax for
INSERT
, which is more readable. Here, you mention the column names as well. So, when such a SQL is issued, unless aNOT NULL
column is missed out, theINSERT
still work, havingnull
updated in missed columns.