Home > database > Write a procedure, using a cursor, bulk import data submitted to the PL/SQL: ORA - 00947: there is n
Write a procedure, using a cursor, bulk import data submitted to the PL/SQL: ORA - 00947: there is n
Time:09-27
I novice a, write a stored procedure, the complete code is as follows, there is no actual effect, don't give me how to write better, I want to 50 submitted once, The create or replace procedure piciCommit as V_count number; V_num number; The BEGIN V_count:=0; V_num:=1; - for cur in (select * from emp) loop - if you use these two lines, can normal compile, run normally, - insert into emp1 values cur; - * * * * * * * * * in the following two lines of compile time can not have the enough value to error, but the same number of columns, emp1 table structure and the emp table exactly the same, all columns allow null, allowed to repeat, For cur in (select empno, ename, job, sal, deptno from emp) loop Insert into emp1 (empno, ename, job, sal, deptno) values cur; - * * * * * * * * * * * * * * * * * V_count: v_count +=1; Dbms_output. Put_line (' first '| | v_count | |' a '); If v_count & gt;=50 then Dbms_output. Put_line (' -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the first '| | v_num | |' commit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- '); V_num:=v_num + 1; commit; V_count:=0; end if; End loop; Dbms_output. Put_line (' -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the first '| | v_num | |' commit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- '); commit; The end;
Also please the great god to have a look, thanks!
CodePudding user response:
CodePudding user response:
Insert into emp1 (empno, ename, job, sal, deptno) values cur; To insert into emp1 values cur; It is ok