Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: newbie SQL question
In article <393D6762.58E845D5_at_Unforgetable.com>,
Walter T Rejuney <BlueSax_at_Unforgetable.com> wrote:
> > Halim Setiyawan wrote:
> >
> > Can anyone tell me a sql command in Oracle 8i that selects/updates
> > only the first entry if there are multiple entries to be return?
> >
> > Any help will be appreciated.
> >
> > Halim.
>
> Ever heard of writing a program? You can't do what you want with just
a
> single select statement most likely but it would be a breeze to handle
> in a pl/sql,pro-c or VB program.
>
kcs as wtr--
this is easy:
update T
set ....
where ....
AND ROWNUM = 1;
or
select * from ( select * from T where ... ) where rownum = 1;
-- Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries Howtos and such: http://osi.oracle.com/~tkyte/index.html Oracle Magazine: http://www.oracle.com/oramag Opinions are mine and do not necessarily reflect those of Oracle Corp Sent via Deja.com http://www.deja.com/ Before you buy.Received on Tue Jun 06 2000 - 00:00:00 CDT