Skip to Main Content

Oracle Database Discussions

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!

Difference between IF THEN .. ELSE and a CASE.. END CASE statements

2664030Feb 4 2016 — edited Feb 4 2016

Hi People,

Hope you are doing fine

I just want to know the difference between a IF THEN..ELSE and a PLSQL CASE statement.

CASE is present in both SQL and PLSQL as like below,

SQL :

select case when 1=1 then 'Hi' end from dual;

PLSQL:

BEGIN

  CASE

  WHEN 1=1 THEN

    NULL;  -- Some executable condition

  END CASE;

END;

/

The above PLSQL CASE..END CASE is exactly equal to IF THEN..ELSE statement and I am not able to spot any difference between them.

Please post some differences between them that you are aware of!

Thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2016
Added on Feb 4 2016
2 comments
8,153 views