Skip to main content

Empty blocks should be removed

ZPA rule for PL/SQL and Oracle SQL · EmptyBlock

A block, subprogram or exception handler whose only statement is NULL does nothing. Most of the time the code that belongs there is missing: a procedure left as a stub, or a handler written to silence an error. When doing nothing is intended, the code does not say why.

This rule reports a NULL statement that is the only statement of a block, subprogram, trigger or method body. An overriding member of an object type is not reported: an empty body there may deliberately replace the supertype's behavior.

Examples​

Noncompliant Code Example
create procedure refresh_rack(p_rack number) is
begin
null; -- Noncompliant
end;
Compliant Solution
create procedure refresh_rack(p_rack number) is
begin
update rack set refreshed_at = sysdate where id = p_rack;
end;