Home » RDBMS Server » Server Administration » Re: Simple Update
Re: Simple Update [message #374995] Tue, 17 July 2001 19:46 Go to next message
Xizzy
Messages: 2
Registered: July 2001
Junior Member
It's only a guess for now, but I'll test it tomorrow and tell you if it works:

UPDATE
(SELECT t1.Field1, t2.Field1 as NewField1
FROM Table1 t1, Table2 t2
WHERE t1.Field2 = t2.Field2)
SET Field1 = NewField1
Re: Follow-up [message #375247 is a reply to message #374995] Wed, 08 August 2001 23:40 Go to previous message
vector
Messages: 1
Registered: August 2001
Junior Member
i think my pl/sql snippet is better than yours

DECLARE
CURSOR c IS
SELECT T1.Field1,T2.Field2
FROM Table1 T1,Table2 T2
WHERE T1.Field2=T2.Field2
FOR UPDATE T1.Field1;

BEGIN
FOR c_cur IN c LOOP
UPDATE Table1 SET Feild1 =c_cur.Field2
WHERE CURRENT OF c;
END LOOP;
END;

vector

thanks in advance
Previous Topic: Difference between Primary key and Unique&notnull on a col
Next Topic: Synchronizing database
Goto Forum:
  


Current Time: Tue Dec 24 07:25:00 CST 2024