Skip to main content

Do not add the DECLARE keyword if the block doesn't have any declaration

ZPA rule for PL/SQL and Oracle SQL · DeclareSectionWithoutDeclarations

The DECLARE keyword of a block introduces its declarations. A block that declares nothing does not need it: BEGIN ... END alone is the same block, and the keyword only suggests declarations that are not there.

This rule reports a DECLARE keyword followed by no declaration.

Examples​

Noncompliant Code Example
begin
declare -- Noncompliant
begin
archive_crates(sysdate - 30);
end;
end;
Compliant Solution
begin
begin
archive_crates(sysdate - 30);
end;
end;