Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Deleting 1 and only 1 row from database
Hello,
If it doesn't matter which one you delete, you can use ROWNUM:
delete from your_table
where column1 = 'a_value'
and column2 = 'another_value'
and rownum = 1 -- or, if you want to delete two : rownum <= 2
/
Marc
NOSPAMstannon_at_yahoo.com wrote:
>
> Hi,
>
> I am a novice to Oracle and SQL and I would like to ask you experts
> for help.
>
> I have a database that has no primary key defined. The database allows
> dulplicate records. I want to remove some of the duplicate records so I
> thought of using "delete", but looking at the syntax, it seems the delete
> command will delete every matches, which is different from my goal -
> only the first matched record.
>
> Can anyone show me the syntax for deleting only 1 record (say, the
> first match)? Thanks!
>
> Stannon
Received on Wed Oct 28 1998 - 00:00:00 CST