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 pl sql variable?

502


What is exit statement?

543


What is output spooling in sql*plus?

549


how do you know if your mysql server is alive? : Sql dba

593


How can you fetch first 5 characters of the string?

550






What are sql indexes?

541


What is a stored procedure in sql with example?

598


How would you convert date into julian date format?

590


What is the reports view in oracle sql developer?

539


What is sql trigger example?

536


Define a temp table?

552


Is postgresql a server?

573


What has stored procedures in sql?

593


what is self-join? : Sql dba

566


How many commands are there in sql?

545