ORA-00913 error: PLSQL: ORA-00913: toomanyvalues
ORA-00913 error: PL/SQL: ORA-00913: too values
ORA-00913 error.
Description: PL/SQL: ORA-00913: too partition values
Objective: To compile a script that can insert data cyclically.
Procedure:
SQL> desc tcustmer
Name Null? Type
-----------------------------------------------------
CUST_CODE not null VARCHAR2 (10)
NAME VARCHAR2 (30)
CITY VARCHAR2 (20)
State char (2)
SQL> CREATE SEQUENCE tcustmer_cust
Increment by 1
Start with 1
Max value 100000000
Caching 10000
NOCYCLE;
SQL> begin
2 for I in 1 .. 10 loop
3 insert into tcustmer
4 values (tcustmer_cust.nextval, 't', 'test' | I, 'beijing', 'cn ');
5 if mod (I, 10) = 0 then
6 commit;
7 end if;
8 end loop;
9 commit;
10 end;
11/
Insert into tcustmer
*
ERROR at line 3:
ORA-06550: line 3, column 20:
PL/SQL: ORA-00913: too then values
ORA-06550: line 3, column 8:
PL/SQL: SQL Statement ignored
Check the inserted values value. The number of columns exceeds the number of columns in the tcustmer table.
The adjustment is as follows:
SQL> begin
For I in 1 .. 10 loop
Insert into tcustmer
Values ('T' | tcustmer_cust.nextval, 'test' | I, 'beijing', 'cn ');
If mod (I, 10) = 0 then
Commit;
End if;
End loop;
Commit;
End;
/
PL/SQL procedure successfully completed.
Summary:
Incorrect understanding of tcustmer_cust.nextval. The purpose of creating a sequence is to eliminate primary key interference. Therefore, you need to put it in the column value when using it.
Installing Oracle 12C in Linux-6-64
Install Oracle 11gR2 (x64) in CentOS 6.4)
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian