Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: update statement PL/SQL
Reallybig wrote:
> Like I mentioned that i'm a newbie.
>
Yeah - it shows... you're top posting, and people here hate it. You will probably not get responses, if you keep top posting.
> I'm using oracle 10g Enterprise.
> My OS is win 2003 server with 2.8 ghz and 512 of ram.
> Index are on empid field for both tables.
> The actual code would be sth like
>
> DECLARE
>
> TYPE emp_record_type IS record(
> empno Emp.empno%type,
> sales Emp.amount%type);
>
> emp_record emp_record_type;
>
> CURSOR c1 IS
> SELECT emp.empno, emp.sale from sales;
>
> BEGIN
> OPEN c1;
> FETCH c1 INTO emp_record;
> while c1%FOUND
> loop
> update employee
> set total_sales = emp_record.sales
> where empid = emp_record.empno;
> FETCH c1 INTO emp_record;
> END LOOP;
> CLOSE c1;
> END;
> /
>
> Thanks in advance.
>
>
[snip!]
What is it you are trying to accomplish?
Just *read* your code: you are updating the field total_sales
with the value of another field; sales.
You're just duplicating values...
-- Regards, Frank van BortelReceived on Thu Apr 28 2005 - 02:52:09 CDT