Home » SQL & PL/SQL » SQL & PL/SQL » what is the use of rowid?
what is the use of rowid? [message #1804] Fri, 31 May 2002 01:09 Go to next message
sureshraj
Messages: 9
Registered: May 2002
Junior Member
how rowid is used to delete duplicate rows?
Re: what is the use of rowid? [message #1806 is a reply to message #1804] Fri, 31 May 2002 02:17 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Here's an example:

SQL> select * from foo order by 1;

COL1
----------
0
0
1
1
1
2
2
4
56

9 rows selected.

SQL> delete from foo
2 .
SQL> delete from foo f
2 where f.rowid > ( select min(rowid)
3 from foo
4 where col1 = f.col1);

4 rows deleted.

SQL> select * from foo order by 1;

COL1
----------
0
1
2
4
56

SQL>

HTH,
MHE
Previous Topic: Urgent !!!!! What is the difference ??
Next Topic: Can we use PL/SQL key words as Coloumn Names
Goto Forum:
  


Current Time: Tue May 21 17:01:06 CDT 2024