×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: SQL
Posted by: Jon Nickerson
Added: Sep 19, 2017 8:29 PM
Modified: Mar 16, 2018 10:35 PM
Views: 6
Tags: no tags
  1. DELETE FROM
  2.    UTL_D_PP.DIALER_JSON_TEMP_TEST
  3. WHERE rowid IN
  4.  (SELECT rowid FROM
  5.    (SELECT
  6.      rowid,
  7.      ROW_NUMBER()
  8.     OVER
  9.      (partition BY "key" ORDER BY "key") dup
  10.     FROM UTL_D_PP.DIALER_JSON_TEMP_TEST)
  11.   WHERE dup > 1);
  12. ----
  13. DELETE FROM cfaw_stu
  14.  WHERE ALTID IN (
  15.  SELECT
  16.  ALTID
  17. FROM
  18.    cfaw_stu a
  19. WHERE
  20.    rowid >
  21.      (SELECT MIN(rowid) FROM cfaw_stu b
  22.       WHERE
  23.          a.ALTID = b.ALTID
  24.       ));
  25. ---
  26. DELETE FROM
  27.    TABLE_NAME A
  28. WHERE
  29.   a.rowid >
  30.    ANY (
  31.      SELECT
  32.         B.rowid
  33.      FROM
  34.         TABLE_NAME B
  35.      WHERE
  36.         A.col1 = B.col1
  37.      AND
  38.         A.col2 = B.col2
  39.         );
  40. ----
  41. -- http://www.dba-oracle.com/t_delete_duplicate_table_rows.htm
  42.