write a query to delete similar records in particular
fields(columns) in different tables

Answer Posted / ramkumar v

CREATE OR REPLACE PROCEDURE DUP AS

DECLARE
TABLENAME_TMP TABLE;

CURSOR C1 IS
SELECT M.TABLE_NAME
FROM USER_TAB_COLS M
WHERE M.COLUMN_NAME LIKE 'EMPNO';

BEGIN

OPEN C1;
LOOP
FETCH C1 INTO TABLENAME_TMP;
WHEN C1%NOTFOUND THEN EXIT;

DELETE FROM TABLENAME_TMP A WHERE ROWID NOT IN
(SELECT MAX(ROWID) FROM TABLENAME_TMP B

WHERE A.EMPNO>=B.EMPNO);
ENDLOOP;
CLOSE C1;
END DUP;

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is bcp? When is it used?

582


tell us something about heap tables. : Sql dba

605


Can I copy :old and :new pseudo-records in/to an oracle stored procedure?

666


What is normalisation in sql?

553


What are three advantages to using sql?

555






what are the features and advantages of object-oriented programming? : Sql dba

549


What is not equal in sql?

511


What are tables and fields?

595


How to pipe multiline string to isql?

580


What are different types of sql?

565


Can primary key be changed?

529


Why function is used in sql?

524


How do you delete duplicates in sql query using rowid?

543


How to use sql*plus built-in timers?

578


How do I create a sql script?

542