ORA-00913 error.Description: PL/SQL: ORA-00913: too export values objective: to write a script that can insert data cyclically operation process: 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.