Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

select top 1 record from resultset (PL/SQL, oracle)

809036Jan 3 2013 — edited Jan 4 2013
i would like to ask how can i select top 1 record from the selected resultset to and then output as list in pl/sql
it is because i always retrieve two or more record from the resultset. my sql like belows:

select id from customer where surname ='WONG';

it returns:

2
3
4

in fact the table contain id 1,2,3,4

i have tried select id from customer where surname='WONG' and rownum=1;
it always return id=1, how can i select top 1 from resultset , in this case, id=2
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2013
Added on Jan 3 2013
10 comments
3,378 views