25 lines
697 B
Plaintext
25 lines
697 B
Plaintext
![]() |
=== Exceptions
|
||
|
|
||
|
Branches in an `IF`/`ELSIF` chain with implementation that contains a single line of code are ignored.
|
||
|
|
||
|
[source,sql]
|
||
|
----
|
||
|
IF param = 1 THEN
|
||
|
sort_order := 0;
|
||
|
ELSIF param = 2 THEN
|
||
|
sort_order := 1;
|
||
|
ELSE
|
||
|
sort_order := 0; -- No issue, usually this is done on purpose to increase the readability
|
||
|
END IF;
|
||
|
----
|
||
|
|
||
|
But this exception does not apply to `IF` chains without `ELSE`-s when all branches have the same single line of code. In case of `IF` chains with `ELSE`-s rule S3923 raises a bug.
|
||
|
|
||
|
[source,sql]
|
||
|
----
|
||
|
IF param = 1 THEN -- Noncompliant, this might have been done on purpose but probably not
|
||
|
sort_order := 0;
|
||
|
ELSIF param = 2 THEN
|
||
|
sort_order := 0;
|
||
|
END IF;
|
||
|
----
|