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
Which constraints we can use while creating database in sql?
What is meaning of <> in sql?
Can %notfound return null after a fetch?
how do you control the max size of a heap table? : Sql dba
How to fetch values from testtable1 that are not in testtable2 without using not keyword?
Can we join more than 2 tables in sql?
what is single byte over head in oracle..?
which operator is used in query for pattern matching? : Sql dba
what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba
Can we perform dml on view?
How much does sqlite cost?
Can we use ddl statements in stored procedure sql server?
What are keys in sql?
List and explain the different types of join clauses supported in ansi-standard sql?
is mysql query is case sensitive? : Sql dba