Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Deleting 1 and only 1 row from database

Re: Deleting 1 and only 1 row from database

From: Marc Billiet <Marc.Billiet_at_hae.hydro.com>
Date: 1998/10/28
Message-ID: <3636B856.B21@hae.hydro.com>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US