Is there any SEVERE contraindications to delete using rowid?
DELETE FROM NETATEMP.SFAC_TESTATA_CASISTICHE
WHERE ROWID IN ( SELECT MIN (ROWID)
FROM NETATEMP.SFAC_TESTATA_CASISTICHE
GROUP BY ID_CASO,
DESCRIZIONE_TECNICA,
DESCRIZIONE_ANALISI,
PDF,
SCARTI,
DATA_INIZIO_ANALISI,
DATA_FINE_ANALISI,
DATA_INSTRADAMENTO,
DATA_RISOLUZIONE,
STRINGA_RICERCA,
SETTIMANA,
DATA_INIZIO_SETT,
DATA_FINE_SETT,
FATTURAZIONE,
IN_ELABORAZIONE
HAVING COUNT (1) > 1);
ROWID s are the fastest way to access a row of data, but if you can do an operation in a single DML statement, that is faster than selecting the data first, then supplying the ROWID to the DML statement. If rows are moved, the ROWID will change. Rows can move due to maintenance operations like shrinks and table moves.
You can use the rowid in the WHERE clause to retrieve rows based on their internal record number. This method is handy when no other unique column exists in a table. Query 4-54 uses a rowid from Query 4-53.
You should not use ROWID as the primary key of a table. If you delete and reinsert a row with the Import and Export utilities, for example, then its rowid may change. If you delete a row, then Oracle may reassign its rowid to a new row inserted later.
It would not be safe if you intended to use the ROWID a long period of time after you SELECT it-- for example, if you allow users to edit data locally and then synchronize with the master database some arbitrary length of time later.
If you assume that min(rowid)
returns the "earliest" row, then yes, you have a problem (because it won't)
If you use min(rowid)
only to get one of the duplicates (and you don't care which), then no, there is nothing wrong with that statement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With