I wonder if there is a way to delete rows between letīs say rownum 15 and rownum 30, itīs easy selecting but with delete I get ORA-01732
anyone know any SQL that might do this :?
I've done this via a PL/SQL-table. You wanna do it with a single SQL?
yea with SQL if possible, if not then pl-sql
Make the PL/SQL-table to store the rowids of the rows to be deleted and .... well here is script I would suggest you, I call your table THE_TABLE and we delete from row 15 till row 30.
set serveroutput on
TYPE PANDO_TYPE IS TABLE OF rowid
INDEX BY BINARY_INTEGER;
cursor C_CURSOR_1 is
ROWNUM <= 30;
i pls_integer; N pls_integer;
i := 0; N := 0;
fetch C_CURSOR_1 into X;
if C_CURSOR_1%notfound then exit; end if;
i := i+1; W_TABLE(i) := X;
for i in 15..W_TABLE.COUNT loop
delete from THE_TABLE where rowid=W_TABLE(i);
N := N+1;
dbms_output.put_line(CHR(10)||'DELETED ROWS: '||N);
burps looks nasty
I will try a bit more with sql if not possible then have to use plsqL
This deletes rows where ROWNUM is between 5 and 10:
delete from scott.emp where rowid in
(select rowid from scott.emp where rownum <= 10
select rowid from scott.emp where rownum <= 5);
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Click Here to Expand Forum to Full Width