Home

Columns to be read with a SELECT statement should be clearly defined

Description

    The "Columns to be read with a SELECT statement should be clearly defined" rule states that when writing a SELECT statement in PL/SQL, the columns that will be read from the database should be explicitly stated. This ensures that the query is only retrieving the necessary data, and that the results of the query are predictable. It also helps to prevent errors and improve the performance of the query.

Key Benefits

  • Clear Definition: Columns to be read with a SELECT statement should be clearly defined, providing a clear rule for use.
  • Efficiency: SELECT statements with particular columns are efficient and can be used to quickly retrieve data from a database.
  • Flexibility: SELECT statements with particular columns are flexible, allowing for complex queries to be written and executed.
  • Scalability: SELECT statements with particular columns are scalable, allowing for large datasets to be queried without sacrificing performance.

 

Non-compliant Code Example

SELECT
    *       --Non compliant code (Select statement with all the columns)
FROM
    CUSTOMERS

Compliant Code Example

SELECT
    NAME ,    --Compliant code (Select statement defined specific columns)
    ADDRESS ,
    CREDIT_LIMIT
FROM
    CUSTOMERS
Visual Expert 2024
 VEPLSQLRULE97