RE: How will you delete duplicating rows from a base t...
The above examples can be used only if there is only one column having repeating values. If all the columns have repeating values i.e. there is total duplicacy of rows then they fail. The following code can be used for any tables only the column name needs to be changed
CREATE TABLE EMP_TEST (a NUMBER b NUMBER);
DECLARE
CURSOR c1 IS SELECT * FROM emp_test FOR UPDATE OF a b NOWAIT;
CURSOR c2 IS SELECT * FROM emp_test FOR UPDATE OF a b NOWAIT;
Emp_rec1 c1 ROWTYPE;
Emp_rec2 c2 ROWTYPE;
N NUMBER;
BEGIN
FOR i IN c1 LOOP
N: 0;
FOR j IN c2 LOOPIF
(i.a j.a AND i.b j.b AND N 1) THENDELETE FROM emp_test WHERE CURRENT OF c2;