Home » RDBMS Server » Server Administration » Follow-up
Follow-up [message #375022] Thu, 19 July 2001 09:53
Xizzy
Messages: 2
Registered: July 2001
Junior Member
This query in my last message will work, but in a very limited set of cases. The requirement is that Table1 must primary key-preverved in the subquery in ()s. Unfortunately this always excludes the subqueries with GROUP BY or statistical functions (MAX, SUM, COUNT, etc.).
A workaround is to update each row separately by executing a PL/SQL snippet like this:

DECLARE
CURSOR c IS SELECT Field2 FROM Table1 FOR UPDATE;
BEGIN
FOR c_cur IN c LOOP
UPDATE Table1 SET Feild1 =
(SELECT t2.Field1 FROM Table2 t2 WHERE t2.Field2 = c_cur.Field2)
WHERE CURRENT OF c;
END LOOP;
END;
Previous Topic: Re: Duplicate values only once
Next Topic: Stored Procedures changing to invalid unexplainable
Goto Forum:
  


Current Time: Mon Dec 23 20:29:14 CST 2024