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

Which constraints we can use while creating database in sql?

606


What is meaning of <> in sql?

579


Can %notfound return null after a fetch?

580


how do you control the max size of a heap table? : Sql dba

530


How to fetch values from testtable1 that are not in testtable2 without using not keyword?

740






Can we join more than 2 tables in sql?

483


what is single byte over head in oracle..?

1861


which operator is used in query for pattern matching? : Sql dba

539


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

563


Can we perform dml on view?

548


How much does sqlite cost?

549


Can we use ddl statements in stored procedure sql server?

507


What are keys in sql?

540


List and explain the different types of join clauses supported in ansi-standard sql?

805


is mysql query is case sensitive? : Sql dba

554