Oracle PRAGMA COVERAGE
Version 21c

General Information
Library Note Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have? Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
Purpose The COVERAGE pragma marks PL/SQL code which is infeasible to test for coverage.

The pragma marks a specific code section. Marking infeasible code improves the quality of coverage metrics used to assess how much testing has been achieved.

Unfortunately none of Oracle's documentation explains what "to test for coverage" means. We will update this page when we figure that out.
Documented No
First Available 12.2
 
COVERAGE
Not Feasible

The code, at right, is from Oracle's documentation but reformatted for readability
PRAGMA COVERAGE (<NOT_FEASIBLE | NOT_FEASIBLE_START | NOT_FEASIBILE_END>);
DECLARE
 x PLS_INTEGER := 42;
 y PLS_INTEGER;
BEGIN
  IF (x > 0) THEN
    y :=2;
  ELSE
    PRAGMA COVERAGE('NOT_FEASIBLE'); -- 1
    z:=3;
  END IF;

  IF (y > 0) THEN
    z :=2;
  ELSE
    PRAGMA COVERAGE('NOT_FEASIBLE'); -- 2
    z :=3;
  END IF;
END;
/
DECLARE
 x PLS_INTEGER := 42;
 y PLS_INTEGER;
BEGIN
  PRAGMA COVERAGE(’NOT_FEASIBLE_START’);
  IF (x > 0) THEN
    y :=2;
  ELSE
    z:=3;
  END IF;

  IF (y > 0) THEN
    z :=2;
  ELSE
    z :=3;
  END IF;
  PRAGMA COVERAGE (’NOT_FEASIBLE_END’);
END;
/

Related Topics
Built-in Functions
Built-in Packages
Database Security
Pragmas
AUTONOMOUS_TRANSACTION
PRAGMA_DEPRECATE
PRAGMA EXCEPTION_INIT
PRAGMA FIPSFLAG
PRAGMA INLINE
PRAGMA SERIALLY_REUSABLE
PRAGMA SUPPLEMENTAL_LOG_DATA
PRAGMA SUPPRESSES_WARNING_6009
What's New In 21c
What's New In 23c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2023 Daniel A. Morgan All Rights Reserved
  DBSecWorx