Skip to content

False Positive: SELECT COUNT(*) INTO flagged as missing exception handling #247

@OleksiiSkopych

Description

@OleksiiSkopych

Rule: Avoid queries without an exception handling block
This is a false positive, because SELECT COUNT(*) INTO always returns a result (even 0), and thus does not require an exception handler. According to PL/SQL behavior, this query cannot raise NO_DATA_FOUND or TOO_MANY_ROWS.

Expected behavior
This query should not be flagged by the rule, as no exception can be raised in this context.

Screenshot
Image

Suggested fix
The rule should exclude aggregate functions like COUNT(*) from requiring an exception handler block, as they return a deterministic result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions