using the slider to the number of sum, gives an error

Hello
I use two tables: emp (identification number, number of sal) and another table sal_given (month varchar, the number of total_sal).
emp table is filled. I use oracle 9iR1 on Windows XP operating system.
Via a slider I want add the salary of the EMP and insert in the field total_sal in the sal_given table.
So I wrote this code, have a look at it,

declare
sum1 number: = 0;
cursor sal_cursor1 is select * from emp;
SAL1 sal_cursor1% rowtype;
Start
Open sal_cursor1;
loop
When the output sal_cursor1% notfound;
sum1: = sum1 + sal1.sal;
end loop;
insert into sal_given values ('feb', sum1);
close sal_cursor1;
end;
/

After running this, Oracle block unexpectedly.then I have to restart the Oracle service. So where is the flaw?

user12222356 wrote:

Really? cursor is to slow down the implementation process?

Sure.

Here is a simple test to show a cursor actually making a simple insertion of more 15 times slower.

SQL> create table t (n number);

Table created.

Elapsed: 00:00:00.00
SQL> insert into t
  2  select level from dual connect by level <= 100000;

100000 rows created.

Elapsed: 00:00:00.17
SQL> rollback;

Rollback complete.

Elapsed: 00:00:00.04
SQL> begin
  2    for c in (
  3      select level x from dual connect by level <= 100000
  4      ) loop
  5    insert into t values (c.x);
  6    end loop;
  7  end;
  8  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:02.75
SQL> rollback;

Rollback complete.

Elapsed: 00:00:00.95
SQL>

Backing up is 20 times slower too.

Tags: Database

Similar Questions

Maybe you are looking for

  • HP Envy H8 1414 Desktop Racing Fan

    Normally, the fan runs very quietly.  Time to time... maybe every 5 minutes the cooling fan will run.  Speed will increase slowly calm down the rage for about 15 seconds, and then she slowly returned to its normal speed alone. Any idea what can be th

  • Thread mode in LabVIEW 2010 bug?

    I had an application written in LabVIEW 2009 for a PSC-2220 who stopped working when it was converted in LabVIEW 2010, and I tracked down the problem to one thing: the software sets the mode of the Serial wire. Call this method simply disables all of

  • Can not see the bar of tasks and start button

    I was trying to connect my video camera and software, when I lost my taks bar and my desktop icons. I can open programs by going to Task Manager, but I would rather just my icons. Can you help me?

  • NullPointerException in screen #navigationMovement Manager

    Hello After you add a VerticalFieldManager to a screen, Manager of navigationMovement super screen throws a NullPointerException and the verticalFieldManager scroll with the trackpad of this point (using the Enter key to scroll works very well and af

  • Disorders R710 PERC6i RAID5

    Hello, this my first question after. before all sorry for my English. I have trouble with r710 perc6i raid 5. 1 hard drive 3 sas can't (it is installed 7CV6H: hard drive, Module, 300G, SAS6, 15 K, 3.5, Seagate -info comes from the support page of del