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!

How to stop CASE once matching the condition

Mohammed ...-OracleApr 16 2015 — edited Apr 17 2015

Hi All,

Please, I am trying to use CASE in a query statement as below:

***********************************

select   emp_id,emp_name,

            CASE

                  when ( emp_name like 'Scott') then 'First One'

                  else '  '

            END  as Description

from employes;

***********************************

What i need to do, is to print 'First One' with the first employe ONLY who is named 'Scott' even if there are others named 'Scott'

But the above example will print 'First One' for all employes who named 'Scott'

May be I am using the wrong function ..

Could you please assist?

Regards,

Mohammed

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2015
Added on Apr 16 2015
12 comments
3,013 views