Movatterモバイル変換


[0]ホーム

URL:


 
» Best Practices Edit on GitHub

Best Practices

Rules which enforce generally accepted best practices.
Table of Contents

TomKytesDespair

Since: PMD 5.1

Priority: Medium (3)

"WHEN OTHERS THEN NULL" hides all errors - (Re)RAISE an exception or call RAISE_APPLICATION_ERROR

This rule is defined by the following XPath expression:

//ExceptionHandler[QualifiedName/@Image='OTHERS'][count(Statement)=1][Statement/UnlabelledStatement/Expression/PrimaryPrefix/Literal/NullLiteral]

Example(s):

CREATEORREPLACEPACKAGEBODYupdate_planned_hrsISPROCEDUREset_new_planned(p_emp_idINNUMBER,p_project_idINNUMBER,p_hoursINNUMBER)ISBEGINUPDATEemployee_on_activityeaSETea.ea_planned_hours=p_hoursWHEREea.ea_emp_id=p_emp_idANDea.ea_proj_id=p_project_id;EXCEPTIONWHENNO_DATA_FOUNDTHENRAISE_APPLICATION_ERROR(-20100,'No such employee or project');ENDset_new_planned;FUNCTIONexisting_planned(p_emp_idINNUMBER,p_project_idINNUMBER)RETURNNUMBERISexisting_hoursNUMBER(4);BEGINSELECTea.ea_planned_hoursINTOexisting_hoursFROMemployee_on_activityeaWHEREea.ea_emp_id=p_emp_idANDea.ea_proj_id=p_project_id;RETURN(existing_hours);EXCEPTIONWHENOTHERSTHENNULL;ENDexisting_planned;ENDupdate_planned_hrs;/

Use this rule by referencing it:

<ruleref="category/plsql/bestpractices.xml/TomKytesDespair"/>

This documentation is written in markdown.
If there is something missing or can be improved, edit this page on github and create a PR: Edit on GitHub

©2025 PMD Open Source Project. All rights reserved.
Site last generated: Nov 28, 2025

PMD                logo


[8]ページ先頭

©2009-2025 Movatter.jp