When a single primitive is tested against three or more values in an ``++IF++``, ``++ELSIF++`` chain, it should be converted to a ``++CASE++`` instead for greater readability.

== Noncompliant Code Example

----
DECLARE
  x PLS_INTEGER := 0;
BEGIN
  IF x = 0 THEN                     -- Noncompliant
    DBMS_OUTPUT.PUT_LINE('x = 0');
  ELSIF x = 1 THEN
    DBMS_OUTPUT.PUT_LINE('x = 1');
  ELSE
    DBMS_OUTPUT.PUT_LINE('x > 1');
  END IF;
END;
/
----

== Compliant Solution

----
DECLARE
  x PLS_INTEGER := 0;
BEGIN
  CASE x
    WHEN 0 THEN
      DBMS_OUTPUT.PUT_LINE('x = 0');
    WHEN 1 THEN
      DBMS_OUTPUT.PUT_LINE('x = 1');
    ELSE
      DBMS_OUTPUT.PUT_LINE('x > 1');
  END CASE;
END;
/
----

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
