Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: update statement PL/SQL

Re: update statement PL/SQL

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Thu, 28 Apr 2005 09:52:09 +0200
Message-ID: <d4q4ft$rs8$1@news1.zwoll1.ov.home.nl>


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 Bortel
Received on Thu Apr 28 2005 - 02:52:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US