db* CODECOP Version 4.3.0 (2022-09-02 07:12:58 +0200) for Trivadis PL/SQL & SQL Coding Guidelines Version 4.2

Copyright 2010-2022 by Trivadis AG
Saegereistrasse 29
CH-8152 Glattbrugg (Zurich)
www.trivadis.com

License

Philipp Salvisberg, Trivadis AG, CH-8152 Glattbrugg
valid thru9999-12-31
valid for versions less than5
max. filesunlimited
max. linesunlimited
max. commandsunlimited
max. bytesunlimited
limited topersonal use

Parameters

path/usr/local/bin/tvdcc/sample
filter(sql|prc|fnc|pks|pkb|trg|vw|tps|tpb|tbp|plb|pls|rcv|spc|typ|aqt|aqp|ctx|dbl|tab|dim|snp|con|collt|seq|syn|grt|sp|spb|sps|pck|md|mdown)$
timeout10
complexity4
output/usr/local/bin/tvdcc/./tvdcc_report.html
templatehtml.xsl
exceltrue
htmltrue
transonlyfalse
cleanuptrue
check
skip0000,1050,2130,3160,3170,5010,7170,7460,7740,8410,8510
nosonartrue
license
validatorcom.trivadis.tvdcc.validators.TrivadisGuidelines3
genmodelfalse

Processing

Start of processing2022-09-02 11:54:21
End of processing2022-09-02 11:54:27
Processing time in seconds5.768

Content

Number of files122
Number of bytes227,509
Number of lines (LOC)9,413
Number of comment lines1,169
Number of blank lines1,428
Number of net lines6,816
Number of commands298
Number of statements (PL/SQL)1,584
Max. cyclomatic complexity5   ( < 11   11..50   > 50 )
Max. Halstead volume575   ( < 1001   1001..3000   > 3000 )
Min. maintainability index (MI)82   ( > 84   64..84   < 64 )
Number of issues298
Number of warnings298
Number of errors0




Issue Overview

#%SeverityCharacteristicsMessage
10.3%BlockerPortability, Reliability
G-2150: Avoid comparisons with NULL value, consider using IS [NOT] NULL.
10.3%BlockerReliability, Testability
G-5030: Never assign predefined exception names to user defined exceptions.
10.3%BlockerReliability, Testability
G-7720: Never use multiple UPDATE OF in trigger event clause.
20.7%CriticalReliability
G-5070: Avoid using Oracle predefined exceptions
20.7%CriticalTestability
G-7910: Never use DML within a SQL macro.
10.3%CriticalReliability
G-2160: Avoid initializing variables using functions in the declaration section.
10.3%CriticalReliability
G-3310: Never commit within a cursor loop.
10.3%CriticalReliability
G-4120: Avoid using %NOTFOUND directly after the FETCH when working with BULK OPERATIONS and LIMIT clause.
10.3%CriticalEfficiency, Reliability
G-4230: Always use a COALESCE instead of a NVL command, if parameter 2 of the NVL function is a function call or a SELECT statement.
10.3%CriticalEfficiency, Reliability
G-4240: Always use a CASE instead of a NVL2 command if parameter 2 or 3 of NVL2 is either a function call or a SELECT statement.
10.3%CriticalMaintainability
G-5020: Never handle unnamed exceptions using the error number.
134.4%MajorMaintainability, Testability
G-2135: Avoid assigning values to local variables that are not used by a subsequent statement.
113.7%MajorMaintainability
G-4365: Never use unconditional CONTINUE or EXIT in a loop.
62.0%MajorChangeability, Maintainability
G-7110: Try to use named notation when calling program units.
51.7%MajorEfficiency
G-3210: Always use BULK OPERATIONS (BULK COLLECT, FORALL) whenever you have to execute a DML statement for more than 4 times.
41.3%MajorMaintainability
G-3120: Always use table aliases when your SQL statement involves more than one source.
41.3%MajorMaintainability
G-4370: Avoid using EXIT to stop loop processing unless you are in a basic loop.
41.3%MajorEfficiency, Maintainability
G-7160: Always explicitly state parameter mode.
31.0%MajorMaintainability
G-2180: Never use quoted identifiers.
31.0%MajorMaintainability, Reliability, Testability
G-3145: Avoid using SELECT * directly from a table or view.
31.0%MajorChangeability, Reliability
G-3180: Always specify column names instead of positional references in ORDER BY clauses.
31.0%MajorReliability
G-5040: Avoid use of WHEN OTHERS clause in an exception section without any other specific handlers.
31.0%MajorReliability
G-5060: Avoid unhandled exceptions
31.0%MajorMaintainability, Reliability, Testability
G-7130: Always use parameters or pull in definitions rather than referencing external variables in a local program unit.
31.0%MajorReliability
G-7230: Avoid declaring global variables public.
20.7%MajorPortability
G-2510: Avoid using the LONG and LONG RAW data types.
20.7%MajorMaintainability, Reliability
G-3140: Try to use anchored records as targets for your cursors.
20.7%MajorChangeability, Reliability
G-3190: Avoid using NATURAL JOIN.
20.7%MajorEfficiency
G-4385: Never use a cursor for loop to check whether a cursor returns data.
20.7%MajorMaintainability, Testability
G-7430: Try to use no more than one RETURN statement within a function.
20.7%MajorMaintainability, Testability
G-7710: Avoid cascading triggers.
20.7%MajorEfficiency
G-8110: Never use SELECT COUNT(*) if you are only interested in the existence of a row.
10.3%MajorReliability
G-1060: Avoid storing ROWIDs or UROWIDs in database tables.
10.3%MajorMaintainability, Reliability
G-2110: Try to use anchored declarations for variables, constants and types.
10.3%MajorReliability
G-2170: Never overload variables.
10.3%MajorPortability, Reliability
G-2190: Avoid using ROWID or UROWID.
10.3%MajorReliability
G-2310: Avoid using CHAR data type.
10.3%MajorPortability
G-2320: Never use VARCHAR data type.
10.3%MajorPortability
G-2330: Never use zero-length strings to substitute NULL.
10.3%MajorMaintainability, Reliability
G-3110: Always specify the target columns when coding an insert statement.
10.3%MajorTestability
G-3185: Never use ROWNUM at the same query level as ORDER BY.
10.3%MajorTestability
G-3220: Always process saved exceptions from a FORALL statement.
10.3%MajorReusability, Testability
G-3320: Try to move transactions within a non-cursor loop into procedures.
10.3%MajorEfficiency, Reliability
G-4130: Always close locally opened cursors.
10.3%MajorReliability
G-4140: Avoid executing any statements between a SQL operation and the usage of an implicit cursor attribute.
10.3%MajorMaintainability, Testability
G-4210: Try to use CASE rather than an IF statement with multiple ELSIF paths.
10.3%MajorReliability, Testability
G-4250: Avoid using identical conditions in different branches of the same IF or CASE statement.
10.3%MajorMaintainability, Testability
G-4310: Never use GOTO statements in your code.
10.3%MajorReliability, Testability
G-4325: Never reuse labels in inner scopes.
10.3%MajorReliability
G-4350: Always use 1 as lower and COUNT() as upper bound when looping through a dense array.
10.3%MajorEfficiency
G-4390: Avoid use of unreferenced FOR loop indexes.
10.3%MajorChangeability, Maintainability
G-5050: Avoid use of the RAISE_APPLICATION_ERROR built-in procedure with a hard-coded 20nnn error number or hard-coded message.
10.3%MajorMaintainability, Testability
G-6010: Always use a character variable to execute dynamic SQL.
10.3%MajorMaintainability, Reliability
G-7140: Always ensure that locally defined procedures or functions are referenced.
10.3%MajorMaintainability, Testability
G-7320: Avoid using RETURN statements in a PROCEDURE.
10.3%MajorTestability
G-7330: Always assign values to OUT parameters.
10.3%MajorMaintainability
G-7420: Always make the RETURN statement the last statement of your function.
10.3%MajorReusability
G-7440: Never use OUT parameters to return values from a function.
10.3%MajorReliability, Testability
G-7450: Never return a NULL value from a BOOLEAN function.
10.3%MajorSecurity
G-7510: Always prefix Oracle supplied packages with owner schema name.
10.3%MajorEfficiency, Maintainability
G-7810: Never use SQL inside PL/SQL to read sequence numbers (or SYSDATE).
10.3%MajorEfficiency, Reliability
G-8120: Never check existence of a row to decide whether to create it or not.
10.3%MajorChangeability, Maintainability
G-8210: Always use synonyms when accessing objects of another application schema.
10.3%MajorMaintainability, Reliability, Security, Testability
G-9010: Always use a format model in string to date/time conversion functions.
10.3%MajorMaintainability, Reliability, Security, Testability
G-9020: Try to use a format model and NLS_NUMERIC_CHARACTERS in string to number conversion functions.
7625.5%MinorMaintainability, Reliability, Reusability, Testability
G-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.
72.3%MinorReliability, Testability
G-9030: Try to define a default value on conversion errors.
62.0%MinorMaintainability
G-1040: Avoid dead code.
51.7%MinorMaintainability
G-1020: Always have a matching loop or block label.
41.3%MinorEfficiency, Maintainability
G-1030: Avoid defining variables that are not used.
41.3%MinorMaintainability
G-4320: Always label your loops.
41.3%MinorTestability
G-9040: Try using FX in string to date/time conversion format model to avoid fuzzy conversion.
31.0%MinorMaintainability
G-2185: Avoid using overly short names for explicitly or implicitly declared identifiers.
31.0%MinorMaintainability, Reliability
G-3150: Try to use identity columns for surrogate keys.
31.0%MinorMaintainability
G-4330: Always use a CURSOR FOR loop to process the complete cursor results unless you are using bulk operations.
31.0%MinorMaintainability
G-4380: Try to label your EXIT WHEN statements.
31.0%MinorChangeability, Maintainability
G-4395: Avoid hard-coded upper or lower bound values with FOR loops.
31.0%MinorMaintainability
G-7120: Always add the name of the program unit to its end keyword.
31.0%MinorMaintainability
G-7410: Avoid standalone functions – put your functions in packages.
31.0%MinorReliability
G-7730: Avoid multiple DML events per trigger.
20.7%MinorMaintainability
G-1010: Try to label your sub blocks.
20.7%MinorMaintainability
G-1070: Avoid nesting comment blocks.
20.7%MinorMaintainability
G-2140: Never initialize variables with NULL.
20.7%MinorEfficiency
G-2220: Try to use PLS_INTEGER instead of NUMBER for arithmetic operations with integer values.
20.7%MinorEfficiency
G-2230: Try to use SIMPLE_INTEGER datatype when appropriate.
20.7%MinorReliability
G-2340: Always define your VARCHAR2 variables using CHAR SEMANTIC (if not defined anchored).
20.7%MinorMaintainability, Portability
G-4220: Try to use CASE rather than DECODE.
20.7%MinorMaintainability
G-4375: Always use EXIT WHEN instead of an IF statement to exit from a loop.
20.7%MinorEfficiency, Maintainability
G-7150: Try to remove unused parameters.
20.7%MinorChangeability
G-7220: Always use forward declaration for private functions and procedures.
10.3%MinorEfficiency, Testability
G-1080: Avoid using the same expression on both sides of a relational comparison operator or a logical operator.
10.3%MinorChangeability
G-2120: Try to have a single location to define your types.
10.3%MinorMaintainability
G-2145: Never self-assign a variable.
10.3%MinorEfficiency
G-2210: Avoid declaring NUMBER variables, constants or subtypes with no precision.
10.3%MinorMaintainability
G-2410: Try to use boolean data type for values with dual meaning.
10.3%MinorMaintainability, Portability, Reusability
G-2610: Never use self-defined weak ref cursor types.
10.3%MinorMaintainability
G-3115: Avoid self-assigning a column.
10.3%MinorMaintainability, Portability
G-3130: Try to use ANSI SQL-92 join syntax.
10.3%MinorMaintainability
G-3195: Always use wildcards in a LIKE clause.
10.3%MinorMaintainability
G-4110: Always use %NOTFOUND instead of NOT %FOUND to check whether a cursor returned data.
10.3%MinorTestability
G-4260: Avoid inverting boolean conditions with NOT.
10.3%MinorTestability
G-4270: Avoid comparing boolean values to boolean literals.
10.3%MinorMaintainability
G-4340: Always use a NUMERIC FOR loop to process a dense array.
10.3%MinorEfficiency
G-4360: Always use a WHILE loop to process a loose array.
10.3%MinorTestability
G-5080: Always use FORMAT_ERROR_BACKTRACE when using FORMAT_ERROR_STACK or SQLERRM.
10.3%MinorMaintainability
G-6020: Try to use output bind arguments in the RETURNING INTO clause of dynamic DML statements rather than the USING clause.
10.3%MinorMaintainability
G-7125: Always use CREATE OR REPLACE instead of CREATE alone.
10.3%MinorEfficiency, Maintainability
G-7210: Try to keep your packages small. Include only few procedures and functions that are used in the same context.
10.3%MinorMaintainability
G-7250: Never use RETURN in package initialization block.
10.3%MinorMaintainability
G-7310: Avoid standalone procedures – put your procedures in packages.




Complex PL/SQL Units

File namePL/SQL UnitLine# Lines# Comment lines# Blank lines# Net lines# StmtsCyclomatic complexityHalstead volumeMaintainability index
guidelines/guideline_1040_04.sqlAnonymousPlsqlBlock1031163114349 93 
guidelines/guideline_4370_45.sqlAnonymousPlsqlBlock1429032913411 82 
guidelines/guideline_4310_39.sqlmy_package.password_check2621032110492 86 
guidelines/guideline_4310_39.sqlmy_package.password_check6321032110492 86 
guidelines/guideline_4320_40.sqlAnonymousPlsqlBlock121803189289 91 
guidelines/guideline_4320_40.sqlAnonymousPlsqlBlock412503259346 85 
guidelines/guideline_4370_45.sqlAnonymousPlsqlBlock542503259346 85 




File Overview

File name# Warnings# Errors# Bytes# Lines# Net lines# Cmds# StmtsMax. cyclomatic complexity Max. Halstead volume Min. MI Elapsed seconds
guidelines/guideline_5080_na.sql901,8105139210147 100 0.008
guidelines/guideline_9010_na.sql801,68536202232 127 0.008
guidelines/guideline_1020_02.sql701,5498262226306 86 0.034
guidelines/guideline_3320_na.sql701,273483329138 109 0.017
guidelines/guideline_4310_39.sql703,64510276322492 86 0.067
guidelines/guideline_4320_40.sql701,4256955218346 85 0.060
guidelines/guideline_7130_62.sql702,6437755214169 99 0.011
guidelines/guideline_8410_na.sql702,8069465416318 95 0.013
guidelines/guideline_9020_na.sql701,87238202240 126 0.011
guidelines/guideline_9030_na.sql701,22235202237 126 0.006
guidelines/guideline_9040_na.sql701,58336202232 127 0.013
guidelines/guideline_1040_04.sql601,4976952219349 93 0.076
guidelines/guideline_2510_25.sql60944402642221 0.009
guidelines/guideline_4370_45.sql601,8888266222411 82 0.011
guidelines/guideline_7220_66.sql602,0117660416114 103 0.026
guidelines/guideline_7910_na.sql601,03338232459 114 0.011
guidelines/guideline_2180_15.sql5054730222451 121 0.009
guidelines/guideline_2185_16.sql5069432222451 121 0.008
guidelines/guideline_4140_34.sql502,4046740211143 123 0.057
guidelines/guideline_6020_59.sql501,83843312241 126 0.009
guidelines/guideline_7330_na.sql5078531212228 136 0.006
guidelines/guideline_7420_73.sql501,052403229114 107 0.007
guidelines/guideline_7430_72.sql501,089453438102 111 0.007
guidelines/guideline_2410_24.sql40953433237124 114 0.013
guidelines/guideline_3120_27.sql401,923603850221 0.013
guidelines/guideline_7120_61.sql401,17149362869 107 0.048
guidelines/guideline_7150_64.sql401,5004939212108 103 0.009
guidelines/guideline_7160_68.sql401,379291820221 0.007
guidelines/guideline_7250_na.sql401,79551322884 116 0.010
guidelines/guideline_3180_na.sql30735271520221 0.007
guidelines/guideline_3310_na.sql302,5568456315385 88 0.061
guidelines/guideline_4110_31.sql309994834210138 106 0.010
guidelines/guideline_4130_33.sql301,803443127128 117 0.012
guidelines/guideline_4385_48.sql30773342626113 117 0.020
guidelines/guideline_5060_56.sql301,84749312682 106 0.008
guidelines/guideline_7125_na.sql301,25449362869 107 0.008
guidelines/guideline_7230_67.sql303,27483515661 127 0.010
guidelines/guideline_7740_na.sql301,928583769125 110 0.010
guidelines/guideline_8310_na.sql301,7175539310123 128 0.010
guidelines/guideline_1010_01.sql20390302021222 140 0.028
guidelines/guideline_1030_03.sql201,330473827139 104 0.033
guidelines/guideline_1070_07.sql20451231024221 0.052
guidelines/guideline_2145_na.sql2073427182682 122 0.012
guidelines/guideline_2220_19.sql20987321622143 0.057
guidelines/guideline_2230_na.sql201,584422022143 0.009
guidelines/guideline_2330_22.sql20723261522143 0.059
guidelines/guideline_3140_29.sql201,2354534210196 128 0.012
guidelines/guideline_3170_na.sql201,3874816100221 0.010
guidelines/guideline_3190_na.sql201,315532450221 0.008
guidelines/guideline_4220_36.sql202,249513340221 0.054
guidelines/guideline_4375_46.sql20927372429132 105 0.048
guidelines/guideline_4380_47.sql202,0136453217444 90 0.010
guidelines/guideline_5030_52.sql202,118653929259 97 0.008
guidelines/guideline_7110_60.sql2079625142270 131 0.006
guidelines/guideline_7170_na.sql204,2288066224575 111 0.017
guidelines/guideline_7710_77.sql201,367665534189 92 0.009
guidelines/guideline_7720_na.sql201,27141282263 112 0.007
guidelines/guideline_7810_na.sql2052523142233 127 0.005
guidelines/guideline_8120_na.sql201,14438262591 108 0.007
guidelines/guideline_na_54.sql202,4407353210143 102 0.012
guidelines/guideline_0000_00.sql1053028183341 134 0.440
guidelines/guideline_1060_06.sql1091338262257 137 0.014
guidelines/guideline_1080_na.sql10949291620221 0.028
guidelines/guideline_2110_08.sql101,364443426100 108 0.014
guidelines/guideline_2120_09.sql1092835233456 127 0.012
guidelines/guideline_2135_na.sql101,547513929189 99 0.021
guidelines/guideline_2140_11.sql1033020122241 134 0.055
guidelines/guideline_2150_12.sql1055526162431 127 0.009
guidelines/guideline_2160_13.sql10932322327185 105 0.013
guidelines/guideline_2170_14.sql101,2914638212217 106 0.015
guidelines/guideline_2190_17.sql101,04431182245 125 0.014
guidelines/guideline_2210_18.sql10822281622143 0.011
guidelines/guideline_2310_20.sql10517201020221 0.007
guidelines/guideline_2320_21.sql1065719820221 0.006
guidelines/guideline_2340_23.sql1070419820221 0.007
guidelines/guideline_2610_na.sql10929392926174 105 0.011
guidelines/guideline_3110_26.sql10484271720221 0.055
guidelines/guideline_3115_na.sql1050717520221 0.009
guidelines/guideline_3130_28.sql10753271720221 0.055
guidelines/guideline_3145_na.sql101,457473024124 124 0.053
guidelines/guideline_3150_na.sql101,63645214130 135 0.015
guidelines/guideline_3185_na.sql10889362320221 0.007
guidelines/guideline_3195_na.sql10999301330221 0.011
guidelines/guideline_3210_30.sql101,621443226226 102 0.013
guidelines/guideline_3220_na.sql101,960534128404 93 0.017
guidelines/guideline_4120_32.sql102,7079569321304 95 0.062
guidelines/guideline_4210_35.sql10826352729175 104 0.009
guidelines/guideline_4230_37.sql1065017520221 0.007
guidelines/guideline_4240_38.sql10768221120221 0.006
guidelines/guideline_4250_na.sql101,1474130210151 104 0.008
guidelines/guideline_4260_na.sql1048525162472 122 0.007
guidelines/guideline_4270_na.sql10740292026121 117 0.008
guidelines/guideline_4325_na.sql1086834246491 116 0.007
guidelines/guideline_4330_41.sql101,148422828173 103 0.008
guidelines/guideline_4340_42.sql101,519493329345 101 0.010
guidelines/guideline_4350_43.sql101,855553537151 109 0.009
guidelines/guideline_4360_44.sql101,9775839211367 98 0.058
guidelines/guideline_4365_na.sql10868302028108 113 0.008
guidelines/guideline_4390_49.sql101,699503928332 99 0.008
guidelines/guideline_4395_50.sql1078830192491 116 0.006
guidelines/guideline_5020_51.sql10948332227104 109 0.006
guidelines/guideline_5040_53.sql101,73443223750 149 0.006
guidelines/guideline_5050_55.sql101,3412682230 181 0.006
guidelines/guideline_5070_57.sql10934261022145 0.004
guidelines/guideline_6010_58.sql1058423142239 134 0.006
guidelines/guideline_7140_63.sql101,58642242425 136 0.008
guidelines/guideline_7210_65.sql1069,4584,2173,3682840221 1.935
guidelines/guideline_7310_69.sql10672271632221 0.007
guidelines/guideline_7320_70.sql101,423432827129 108 0.008
guidelines/guideline_7410_71.sql10625221222143 0.007
guidelines/guideline_7440_74.sql1063424152321 133 0.006
guidelines/guideline_7450_75.sql10547231422143 0.005
guidelines/guideline_7510_76.sql1057722122247 133 0.005
guidelines/guideline_7730_na.sql101,42544263682 114 0.006
guidelines/guideline_8110_78.sql101,504524127244 95 0.010
guidelines/guideline_8210_79.sql101,520463136114 107 0.008
guidelines/guideline_8510_na.sql101,177413225131 104 0.008
guidelines/guideline_1050_05.sql001,8175838310124 101 0.016
guidelines/guideline_2130_10.sql001,21841223444 129 0.057
guidelines/guideline_3160_na.sql001,588552946151 111 0.054
guidelines/guideline_5010_na.sql0091532122479 158 0.006
guidelines/guideline_7460_na.sql00803211120221 0.004
Total2980227,5099,4136,8162981,5845575824.514




File Issues

guidelines/guideline_5080_na.sql overview

Issue#LineSeverityMessageCode Excerpt
117MajorG-7110: Try to use named notation when calling program units.in_customer_id
217MajorG-7110: Try to use named notation when calling program units.in_discount
336MajorG-7110: Try to use named notation when calling program units.in_customer_id
436MajorG-7110: Try to use named notation when calling program units.in_discount
523MinorG-5080: Always use FORMAT_ERROR_BACKTRACE when using FORMAT_ERROR_STACK or SQLERRM.sqlerrm
613MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_customer_id in customer.id%type
714MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_discount in customer.discount_percentage%type
832MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_customer_id in customer.id%type
933MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_discount in customer.discount_percentage%type

guidelines/guideline_9010_na.sql overview

Issue#LineSeverityMessageCode Excerpt
120MajorG-9010: Always use a format model in string to date/time conversion functions.to_date(in_dob_str)
216MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
317MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dob_str in varchar2
428MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
529MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dob_str in varchar2
620MinorG-9030: Try to define a default value on conversion errors.to_date(in_dob_str)
732MinorG-9030: Try to define a default value on conversion errors.to_date(in_dob_str,'YYYY-MM-DD')
832MinorG-9040: Try using FX in string to date/time conversion format model to avoid fuzzy conversion.'YYYY-MM-DD'

guidelines/guideline_1020_02.sql overview

Issue#LineSeverityMessageCode Excerpt
136MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit basic_loop
273MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit basic_loop
317MinorG-1020: Always have a matching loop or block label.<<prepare_data>>
422MinorG-1020: Always have a matching loop or block label.<<process_data>>
528MinorG-1020: Always have a matching loop or block label.<<while_loop>>
634MinorG-1020: Always have a matching loop or block label.<<basic_loop>>
739MinorG-1020: Always have a matching loop or block label.<<for_loop>>

guidelines/guideline_3320_na.sql overview

Issue#LineSeverityMessageCode Excerpt
114MajorG-3210: Always use BULK OPERATIONS (BULK COLLECT, FORALL) whenever you have to execute a DML statement for more than 4 times.for l_counter in 1..5 loop insert into headers (id,text) values (l_counter,'Number ' || l_counter); insert into lines (header_id,line_no,text) select l_counter,rownum,'Line ' || rownum from dual connect by level <= 3; commit; end loop create_headers
216MajorG-3210: Always use BULK OPERATIONS (BULK COLLECT, FORALL) whenever you have to execute a DML statement for more than 4 times.for l_counter in 1..5 loop insert into headers (id,text) values (l_counter,'Number ' || l_counter); insert into lines (header_id,line_no,text) select l_counter,rownum,'Line ' || rownum from dual connect by level <= 3; commit; end loop create_headers
321MajorG-3320: Try to move transactions within a non-cursor loop into procedures.commit
412MinorG-4395: Avoid hard-coded upper or lower bound values with FOR loops.1..5
543MinorG-4395: Avoid hard-coded upper or lower bound values with FOR loops.1..5
628MinorG-7120: Always add the name of the program unit to its end keyword.create_rows
729MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.p_header_id in headers.id%type

guidelines/guideline_4310_39.sql overview

Issue#LineSeverityMessageCode Excerpt
138MajorG-4310: Never use GOTO statements in your code.goto check_other_things
275MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit check_digit
375MajorG-4370: Avoid using EXIT to stop loop processing unless you are in a basic loop.exit check_digit
475MinorG-4375: Always use EXIT WHEN instead of an IF statement to exit from a loop.exit check_digit
518MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_password in varchar2
655MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_password in varchar2
792MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_password in varchar2

guidelines/guideline_4320_40.sql overview

Issue#LineSeverityMessageCode Excerpt
120MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit
251MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit basic_loop
314MinorG-4320: Always label your loops.while (i <= co_max_value) loop i := i + co_increment; end loop
419MinorG-4320: Always label your loops.loop exit; end loop
523MinorG-4320: Always label your loops.for i in co_min_value..co_max_value loop sys.dbms_output.put_line(i); end loop
628MinorG-4320: Always label your loops.for r_employee in (select last_name from employees) loop sys.dbms_output.put_line(r_employee.last_name); end loop
720MinorG-4380: Try to label your EXIT WHEN statements.exit

guidelines/guideline_7130_62.sql overview

Issue#LineSeverityMessageCode Excerpt
122MajorG-7130: Always use parameters or pull in definitions rather than referencing external variables in a local program unit.r_emp
223MajorG-7130: Always use parameters or pull in definitions rather than referencing external variables in a local program unit.r_emp
323MajorG-7130: Always use parameters or pull in definitions rather than referencing external variables in a local program unit.r_emp
416MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
546MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
649MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_salary in employees.salary%type
750MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_comm_pct in employees.commission_pct%type

guidelines/guideline_8410_na.sql overview

Issue#LineSeverityMessageCode Excerpt
138MajorG-5040: Avoid use of WHEN OTHERS clause in an exception section without any other specific handlers.when others then -- log error lock_up.release_lock(in_lock_name => co_lock_name); raise;
289MajorG-5040: Avoid use of WHEN OTHERS clause in an exception section without any other specific handlers.when others then -- log error lock_up.release_lock(in_lock_handle => l_handle); raise;
317MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_lock_name in varchar2
423MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_lock_name in varchar2
549MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_lock_name in varchar2
650MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_release_on_commit in boolean := false
771MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_lock_handle in varchar2

guidelines/guideline_9020_na.sql overview

Issue#LineSeverityMessageCode Excerpt
122MajorG-9020: Try to use a format model and NLS_NUMERIC_CHARACTERS in string to number conversion functions.to_number(in_salary)
218MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
319MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_salary in varchar2
430MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
531MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_salary in varchar2
622MinorG-9030: Try to define a default value on conversion errors.to_number(in_salary)
734MinorG-9030: Try to define a default value on conversion errors.to_number(in_salary,'99999999999999999999.99999',q'[nls_numeric_characters='.,']')

guidelines/guideline_9030_na.sql overview

Issue#LineSeverityMessageCode Excerpt
114MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
215MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dob_str in varchar2
327MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
428MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dob_str in varchar2
518MinorG-9030: Try to define a default value on conversion errors.to_date(in_dob_str,'YYYY-MM-DD')
618MinorG-9040: Try using FX in string to date/time conversion format model to avoid fuzzy conversion.'YYYY-MM-DD'
731MinorG-9040: Try using FX in string to date/time conversion format model to avoid fuzzy conversion.'YYYY-MM-DD'

guidelines/guideline_9040_na.sql overview

Issue#LineSeverityMessageCode Excerpt
116MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
217MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dob_str in varchar2
328MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
429MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dob_str in varchar2
520MinorG-9030: Try to define a default value on conversion errors.to_date(in_dob_str,'YYYY-MM-DD')
632MinorG-9030: Try to define a default value on conversion errors.to_date(in_dob_str,'FXYYYY-MM-DD')
720MinorG-9040: Try using FX in string to date/time conversion format model to avoid fuzzy conversion.'YYYY-MM-DD'

guidelines/guideline_1040_04.sql overview

Issue#LineSeverityMessageCode Excerpt
119MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit my_loop
211MinorG-1040: Avoid dead code.2 = 3
319MinorG-1040: Avoid dead code.exit my_loop
426MinorG-1040: Avoid dead code.'x' = 'y'
538MinorG-1040: Avoid dead code.5 = 6
645MinorG-1040: Avoid dead code.return

guidelines/guideline_2510_25.sql overview

Issue#LineSeverityMessageCode Excerpt
110MajorG-2510: Avoid using the LONG and LONG RAW data types.g_long long;
211MajorG-2510: Avoid using the LONG and LONG RAW data types.g_raw long raw;
310MajorG-7230: Avoid declaring global variables public.g_long
411MajorG-7230: Avoid declaring global variables public.g_raw
532MinorG-1030: Avoid defining variables that are not used.g_long
633MinorG-1030: Avoid defining variables that are not used.g_raw

guidelines/guideline_4370_45.sql overview

Issue#LineSeverityMessageCode Excerpt
125MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit basic_loop
243MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit process_employees
364MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit basic_loop
420MajorG-4370: Avoid using EXIT to stop loop processing unless you are in a basic loop.exit while_loop when i > co_max_value
532MajorG-4370: Avoid using EXIT to stop loop processing unless you are in a basic loop.exit for_loop when i = co_max_value
643MajorG-4370: Avoid using EXIT to stop loop processing unless you are in a basic loop.exit process_employees

guidelines/guideline_7220_66.sql overview

Issue#LineSeverityMessageCode Excerpt
114MinorG-7220: Always use forward declaration for private functions and procedures.does_exist
214MinorG-7220: Always use forward declaration for private functions and procedures.does_exist
314MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_department_id in departments.department_id%type
432MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_department_id in departments.department_id%type
551MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_department_id in departments.department_id%type
658MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_department_id in departments.department_id%type

guidelines/guideline_7910_na.sql overview

Issue#LineSeverityMessageCode Excerpt
118CriticalG-7910: Never use DML within a SQL macro.insert
220CriticalG-7910: Never use DML within a SQL macro.commit
313MinorG-7410: Avoid standalone functions – put your functions in packages.row_generator
429MinorG-7410: Avoid standalone functions – put your functions in packages.row_generator
514MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_num_rows in number
630MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_num_rows in number

guidelines/guideline_2180_15.sql overview

Issue#LineSeverityMessageCode Excerpt
112MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement."sal+comm" := "my constant"
225MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_sal_comm := co_my_constant
38MajorG-2180: Never use quoted identifiers."sal+comm"
49MajorG-2180: Never use quoted identifiers."my constant"
510MajorG-2180: Never use quoted identifiers."my exception"

guidelines/guideline_2185_16.sql overview

Issue#LineSeverityMessageCode Excerpt
114MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.i := c
227MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_sal_comm := co_my_constant
310MinorG-2185: Avoid using overly short names for explicitly or implicitly declared identifiers.i integer;
411MinorG-2185: Avoid using overly short names for explicitly or implicitly declared identifiers.c constant integer := 1;
512MinorG-2185: Avoid using overly short names for explicitly or implicitly declared identifiers.e exception;

guidelines/guideline_4140_34.sql overview

Issue#LineSeverityMessageCode Excerpt
132MajorG-4140: Avoid executing any statements between a SQL operation and the usage of an implicit cursor attribute.sql%rowcount
218MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dept_id in departments.department_id%type
323MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
444MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dept_id in departments.department_id%type
549MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type

guidelines/guideline_6020_59.sql overview

Issue#LineSeverityMessageCode Excerpt
122MinorG-6020: Try to use output bind arguments in the RETURNING INTO clause of dynamic DML statements rather than the USING clause.out out_new_salary
212MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
313MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_increase_pct in types_up.percentage
429MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
530MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_increase_pct in types_up.percentage

guidelines/guideline_7330_na.sql overview

Issue#LineSeverityMessageCode Excerpt
116MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_message := 'Hello, ' || in_name
212MajorG-7330: Always assign values to OUT parameters.out_greeting
312MinorG-7150: Try to remove unused parameters.out_greeting out varchar2
411MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_name in varchar2
524MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_name in varchar2

guidelines/guideline_7420_73.sql overview

Issue#LineSeverityMessageCode Excerpt
118MajorG-7420: Always make the RETURN statement the last statement of your function.return l_ret
28MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_from in pls_integer
39MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_to in pls_integer
427MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_from in pls_integer
528MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_to in pls_integer

guidelines/guideline_7430_72.sql overview

Issue#LineSeverityMessageCode Excerpt
112MajorG-7430: Try to use no more than one RETURN statement within a function.return true
214MajorG-7430: Try to use no more than one RETURN statement within a function.return false
38MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_value in pls_integer
422MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_value in pls_integer
539MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_value in pls_integer

guidelines/guideline_2410_24.sql overview

Issue#LineSeverityMessageCode Excerpt
114MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_bigger := constants_up.co_numeric_true
228MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_bigger := true
341MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_bigger := nvl(co_newfile < co_oldfile,false)
411MinorG-2410: Try to use boolean data type for values with dual meaning. (co_numeric_false, co_numeric_true).l_bigger pls_integer;

guidelines/guideline_3120_27.sql overview

Issue#LineSeverityMessageCode Excerpt
19MajorG-3120: Always use table aliases when your SQL statement involves more than one source.last_name
210MajorG-3120: Always use table aliases when your SQL statement involves more than one source.first_name
311MajorG-3120: Always use table aliases when your SQL statement involves more than one source.department_name
424MajorG-3120: Always use table aliases when your SQL statement involves more than one source.employee_id

guidelines/guideline_7120_61.sql overview

Issue#LineSeverityMessageCode Excerpt
110MinorG-7120: Always add the name of the program unit to its end keyword.employee_api
211MinorG-7120: Always add the name of the program unit to its end keyword.employee_by_id
311MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
432MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type

guidelines/guideline_7150_64.sql overview

Issue#LineSeverityMessageCode Excerpt
19MinorG-7150: Try to remove unused parameters.in_manager_id in departments.manager_id%type
28MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_department_id in departments.department_id%type
39MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_manager_id in departments.manager_id%type
431MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_department_id in departments.department_id%type

guidelines/guideline_7160_68.sql overview

Issue#LineSeverityMessageCode Excerpt
112MajorG-7160: Always explicitly state parameter mode.in_first_name employees.first_name%type
213MajorG-7160: Always explicitly state parameter mode.in_last_name employees.last_name%type
314MajorG-7160: Always explicitly state parameter mode.in_email employees.email%type
415MajorG-7160: Always explicitly state parameter mode.in_department_id employees.department_id%type

guidelines/guideline_7250_na.sql overview

Issue#LineSeverityMessageCode Excerpt
127MinorG-1040: Avoid dead code.return
227MinorG-7250: Never use RETURN in package initialization block.return
313MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_increase in types_up.sal_increase_type
437MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_increase in types_up.sal_increase_type

guidelines/guideline_3180_na.sql overview

Issue#LineSeverityMessageCode Excerpt
115MajorG-3180: Always specify column names instead of positional references in ORDER BY clauses.4
215MajorG-3180: Always specify column names instead of positional references in ORDER BY clauses.1
315MajorG-3180: Always specify column names instead of positional references in ORDER BY clauses.3

guidelines/guideline_3310_na.sql overview

Issue#LineSeverityMessageCode Excerpt
138CriticalG-3310: Never commit within a cursor loop.commit
232MajorG-3210: Always use BULK OPERATIONS (BULK COLLECT, FORALL) whenever you have to execute a DML statement for more than 4 times.for r_order in ( select o.order_id,o.customer_id from orders o where o.order_status = 'New' ) loop l_discount := sales_api.calculate_discount(p_customer_id => r_order.customer_id); update order_lines ol set ol.discount = l_discount where ol.order_id = r_order.order_id; l_counter := l_counter + 1; if l_counter = 100 then commit; l_counter := 0; end if; end loop new_orders
361MajorG-3210: Always use BULK OPERATIONS (BULK COLLECT, FORALL) whenever you have to execute a DML statement for more than 4 times.for r_order in ( select o.order_id,o.customer_id from orders o where o.order_status = 'New' ) loop l_discount := sales_api.calculate_discount(p_customer_id => r_order.customer_id); update order_lines ol set ol.discount = l_discount where ol.order_id = r_order.order_id; end loop new_orders

guidelines/guideline_4110_31.sql overview

Issue#LineSeverityMessageCode Excerpt
121MinorG-4110: Always use %NOTFOUND instead of NOT %FOUND to check whether a cursor returned data.not c_employees%found
220MinorG-4330: Always use a CURSOR FOR loop to process the complete cursor results unless you are using bulk operations.fetch c_employees into r_employee
342MinorG-4330: Always use a CURSOR FOR loop to process the complete cursor results unless you are using bulk operations.fetch c_employees into r_employee

guidelines/guideline_4130_33.sql overview

Issue#LineSeverityMessageCode Excerpt
120MajorG-4130: Always close locally opened cursors.open c_department_salary(p_dept_id => in_dept_id)
212MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dept_id in departments.department_id%type
330MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dept_id in departments.department_id%type

guidelines/guideline_4385_48.sql overview

Issue#LineSeverityMessageCode Excerpt
116MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_employee_found := true
231MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_employee_found := c_employees%found
314MajorG-4385: Never use a cursor for loop to check whether a cursor returns data.for r_employee in c_employees loop l_employee_found := true; end loop check_employees

guidelines/guideline_5060_56.sql overview

Issue#LineSeverityMessageCode Excerpt
120MajorG-5060: Avoid unhandled exceptionsselect department_name into l_department_name from departments where department_id = in_id
216MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_id in departments.department_id%type
332MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_id in departments.department_id%type

guidelines/guideline_7125_na.sql overview

Issue#LineSeverityMessageCode Excerpt
110MinorG-7125: Always use CREATE OR REPLACE instead of CREATE alone.employee_api
211MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type
332MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_employee_id in employees.employee_id%type

guidelines/guideline_7230_67.sql overview

Issue#LineSeverityMessageCode Excerpt
125MajorG-7230: Avoid declaring global variables public.g_salary_increase
233MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_increase in types_up.sal_increase_type
364MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_increase in types_up.sal_increase_type

guidelines/guideline_7740_na.sql overview

Issue#LineSeverityMessageCode Excerpt
121MinorG-3150: Try to use identity columns for surrogate keys.nextval
235MinorG-3150: Try to use identity columns for surrogate keys.nextval
317MinorG-7730: Avoid multiple DML events per trigger.insert or update on departments

guidelines/guideline_8310_na.sql overview

Issue#LineSeverityMessageCode Excerpt
118MajorG-5060: Avoid unhandled exceptionsselect * into r_return from departments where department_name = in_dept_name
236MajorG-5060: Avoid unhandled exceptionsselect * into r_return from departments where department_name = l_dept_name
310MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_dept_name in departments.department_name%type

guidelines/guideline_1010_01.sql overview

Issue#LineSeverityMessageCode Excerpt
18MinorG-1010: Try to label your sub blocks.begin null; end
212MinorG-1010: Try to label your sub blocks.begin null; end

guidelines/guideline_1030_03.sql overview

Issue#LineSeverityMessageCode Excerpt
110MinorG-1030: Avoid defining variables that are not used.l_first_name
212MinorG-1030: Avoid defining variables that are not used.e_good

guidelines/guideline_1070_07.sql overview

Issue#LineSeverityMessageCode Excerpt
19MinorG-1070: Avoid nesting comment blocks./* comment one -- nested comment two */
211MinorG-1070: Avoid nesting comment blocks.-- comment three /* nested comment four */

guidelines/guideline_2145_na.sql overview

Issue#LineSeverityMessageCode Excerpt
112MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_function_result := maintenance.get_config('parallel_degree')
213MinorG-2145: Never self-assign a variable.l_parallel_degree := l_parallel_degree

guidelines/guideline_2220_19.sql overview

Issue#LineSeverityMessageCode Excerpt
114MinorG-2220: Try to use PLS_INTEGER instead of NUMBER for arithmetic operations with integer values.number(5,0)
214MinorG-2230: Try to use SIMPLE_INTEGER datatype when appropriate.number(5,0)

guidelines/guideline_2230_na.sql overview

Issue#LineSeverityMessageCode Excerpt
120MinorG-2220: Try to use PLS_INTEGER instead of NUMBER for arithmetic operations with integer values.number(5,0)
220MinorG-2230: Try to use SIMPLE_INTEGER datatype when appropriate.number(5,0)

guidelines/guideline_2330_22.sql overview

Issue#LineSeverityMessageCode Excerpt
19MajorG-2330: Never use zero-length strings to substitute NULL.:= ''
29MinorG-2340: Always define your VARCHAR2 variables using CHAR SEMANTIC (if not defined anchored).varchar2(1)

guidelines/guideline_3140_29.sql overview

Issue#LineSeverityMessageCode Excerpt
117MajorG-3140: Try to use anchored records as targets for your cursors.into l_employee_id,l_first_name,l_last_name
222MajorG-3140: Try to use anchored records as targets for your cursors.into l_employee_id,l_first_name,l_last_name

guidelines/guideline_3170_na.sql overview

Issue#LineSeverityMessageCode Excerpt
123MajorG-3145: Avoid using SELECT * directly from a table or view.*
242MajorG-3145: Avoid using SELECT * directly from a table or view.*

guidelines/guideline_3190_na.sql overview

Issue#LineSeverityMessageCode Excerpt
113MajorG-3190: Avoid using NATURAL JOIN.natural join departments d
232MajorG-3190: Avoid using NATURAL JOIN.natural join departments d

guidelines/guideline_4220_36.sql overview

Issue#LineSeverityMessageCode Excerpt
111MinorG-4220: Try to use CASE rather than DECODE.decode(ctry.country_code, constants_up.co_ctry_uk, constants_up.co_lang_english , constants_up.co_ctry_fr, constants_up.co_lang_french , constants_up.co_ctry_de, constants_up.co_lang_german , constants_up.co_lang_not_supported)
218MinorG-4220: Try to use CASE rather than DECODE.decode(ctry.country_code, constants_up.co_ctry_uk, constants_up.co_lang_english , constants_up.co_ctry_fr, constants_up.co_lang_french , null , constants_up.co_lang_unknown , constants_up.co_lang_not_supported)

guidelines/guideline_4375_46.sql overview

Issue#LineSeverityMessageCode Excerpt
116MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.exit process_employees
216MinorG-4375: Always use EXIT WHEN instead of an IF statement to exit from a loop.exit process_employees

guidelines/guideline_4380_47.sql overview

Issue#LineSeverityMessageCode Excerpt
129MinorG-4380: Try to label your EXIT WHEN statements.exit when l_innerlp = co_exit_value
232MinorG-4380: Try to label your EXIT WHEN statements.exit when l_innerlp = co_exit_value

guidelines/guideline_5030_52.sql overview

Issue#LineSeverityMessageCode Excerpt
116BlockerG-5030: Never assign predefined exception names to user defined exceptions.no_data_found exception;
226CriticalG-5070: Avoid using Oracle predefined exceptionsraise no_data_found

guidelines/guideline_7110_60.sql overview

Issue#LineSeverityMessageCode Excerpt
114MajorG-7110: Try to use named notation when calling program units.r_employee
214MajorG-7110: Try to use named notation when calling program units.co_id

guidelines/guideline_7170_na.sql overview

Issue#LineSeverityMessageCode Excerpt
122MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_wait in integer
258MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.in_wait in integer

guidelines/guideline_7710_77.sql overview

Issue#LineSeverityMessageCode Excerpt
111MajorG-7710: Avoid cascading triggers.departments_hist
243MajorG-7710: Avoid cascading triggers.departments_hist

guidelines/guideline_7720_na.sql overview

Issue#LineSeverityMessageCode Excerpt
112BlockerG-7720: Never use multiple UPDATE OF in trigger event clause.update of department_id
212MinorG-7730: Avoid multiple DML events per trigger.update of department_id or update of department_name on departments

guidelines/guideline_7810_na.sql overview

Issue#LineSeverityMessageCode Excerpt
121MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_sequence_number := employees_seq.nextval
211MajorG-7810: Never use SQL inside PL/SQL to read sequence numbers (or SYSDATE).employees_seq.nextval

guidelines/guideline_8120_na.sql overview

Issue#LineSeverityMessageCode Excerpt
114MajorG-8110: Never use SELECT COUNT(*) if you are only interested in the existence of a row.count(*)
219MajorG-8120: Never check existence of a row to decide whether to create it or not.l_count = 0 then insert into departments values in_r_department;

guidelines/guideline_na_54.sql overview

Issue#LineSeverityMessageCode Excerpt
118MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.date_in in date
250MinorG-8310: Always validate input parameter size by assigning the parameter to a size limited variable in the declaration section of program unit.date_in in date

guidelines/guideline_0000_00.sql overview

Issue#LineSeverityMessageCode Excerpt
116MinorG-2140: Never initialize variables with NULL.l_value pls_integer := null;

guidelines/guideline_1060_06.sql overview

Issue#LineSeverityMessageCode Excerpt
121MajorG-1060: Avoid storing ROWIDs or UROWIDs in database tables.rowid

guidelines/guideline_1080_na.sql overview

Issue#LineSeverityMessageCode Excerpt
116MinorG-1080: Avoid using the same expression on both sides of a relational comparison operator or a logical operator.emp.salary > 3000 or emp.salary > 3000

guidelines/guideline_2110_08.sql overview

Issue#LineSeverityMessageCode Excerpt
111MajorG-2110: Try to use anchored declarations for variables, constants and types.l_last_name varchar2(20 char);

guidelines/guideline_2120_09.sql overview

Issue#LineSeverityMessageCode Excerpt
112MinorG-2120: Try to have a single location to define your types.subtype big_string_type is varchar2(1000 char);

guidelines/guideline_2135_na.sql overview

Issue#LineSeverityMessageCode Excerpt
119MajorG-2135: Avoid assigning values to local variables that are not used by a subsequent statement.l_message := 'Hello, ' || l_last_name

guidelines/guideline_2140_11.sql overview

Issue#LineSeverityMessageCode Excerpt
18MinorG-2140: Never initialize variables with NULL.l_note big_string_type := null;

guidelines/guideline_2150_12.sql overview

Issue#LineSeverityMessageCode Excerpt
112BlockerG-2150: Avoid comparisons with NULL value, consider using IS [NOT] NULL.l_value = null

guidelines/guideline_2160_13.sql overview

Issue#LineSeverityMessageCode Excerpt
19CriticalG-2160: Avoid initializing variables using functions in the declaration section.l_department_name departments.department_name%type := department_api.name_by_id(in_id => co_department_id);

guidelines/guideline_2170_14.sql overview

Issue#LineSeverityMessageCode Excerpt
117MajorG-2170: Never overload variables.l_variable

guidelines/guideline_2190_17.sql overview

Issue#LineSeverityMessageCode Excerpt
118MajorG-2190: Avoid using ROWID or UROWID.rowid

guidelines/guideline_2210_18.sql overview

Issue#LineSeverityMessageCode Excerpt
110MinorG-2210: Avoid declaring NUMBER variables, constants or subtypes with no precision.number

guidelines/guideline_2310_20.sql overview

Issue#LineSeverityMessageCode Excerpt
111MajorG-2310: Avoid using CHAR data type.char(200)

guidelines/guideline_2320_21.sql overview

Issue#LineSeverityMessageCode Excerpt
111MajorG-2320: Never use VARCHAR data type.varchar(200)

guidelines/guideline_2340_23.sql overview

Issue#LineSeverityMessageCode Excerpt
111MinorG-2340: Always define your VARCHAR2 variables using CHAR SEMANTIC (if not defined anchored).varchar2(200)

guidelines/guideline_2610_na.sql overview

Issue#LineSeverityMessageCode Excerpt
110MinorG-2610: Never use self-defined weak ref cursor types.type local_weak_cursor_type is ref cursor;

guidelines/guideline_3110_26.sql overview

Issue#LineSeverityMessageCode Excerpt
18MajorG-3110: Always specify the target columns when coding an insert statement.insert into departments values ( departments_seq.nextval ,'Support' ,100 ,10)

guidelines/guideline_3115_na.sql overview

Issue#LineSeverityMessageCode Excerpt
111MinorG-3115: Avoid self-assigning a column.first_name = first_name

guidelines/guideline_3130_28.sql overview

Issue#LineSeverityMessageCode Excerpt
112MinorG-3130: Try to use ANSI SQL-92 join syntax.employees e ,departments d

guidelines/guideline_3145_na.sql overview

Issue#LineSeverityMessageCode Excerpt
119MajorG-3145: Avoid using SELECT * directly from a table or view.*

guidelines/guideline_3150_na.sql overview

Issue#LineSeverityMessageCode Excerpt
126MinorG-3150: Try to use identity columns for surrogate keys.nextval

guidelines/guideline_3185_na.sql overview

Issue#LineSeverityMessageCode Excerpt
117MajorG-3185: Never use ROWNUM at the same query level as ORDER BY.rownum

guidelines/guideline_3195_na.sql overview

Issue#LineSeverityMessageCode Excerpt
115MinorG-3195: Always use wildcards in a LIKE clause.e.last_name like 'Smith'

guidelines/guideline_3210_30.sql overview

Issue#LineSeverityMessageCode Excerpt
122MajorG-3210: Always use BULK OPERATIONS (BULK COLLECT, FORALL) whenever you have to execute a DML statement for more than 4 times.for i in 1..t_employee_ids.count() loop update employees set salary = salary + (salary * co_increase) where employee_id = t_employee_ids(i); end loop process_employees

guidelines/guideline_3220_na.sql overview

Issue#LineSeverityMessageCode Excerpt
122MajorG-3220: Always process saved exceptions from a FORALL statement.forall i in 1..t_employee_ids.count() save exceptions update employees set salary = salary + (salary * co_increase) where employee_id = t_employee_ids(i)

guidelines/guideline_4120_32.sql overview

Issue#LineSeverityMessageCode Excerpt
126CriticalG-4120: Avoid using %NOTFOUND directly after the FETCH when working with BULK OPERATIONS and LIMIT clause.c_employees%notfound

guidelines/guideline_4210_35.sql overview

Issue#LineSeverityMessageCode Excerpt
110MajorG-4210: Try to use CASE rather than an IF statement with multiple ELSIF paths.if l_color = constants_up.co_red then my_package.do_red(); elsif l_color = constants_up.co_blue then my_package.do_blue(); elsif l_color = constants_up.co_black then my_package.do_black(); end if

guidelines/guideline_4230_37.sql overview

Issue#LineSeverityMessageCode Excerpt
110CriticalG-4230: Always use a COALESCE instead of a NVL command, if parameter 2 of the NVL function is a function call or a SELECT statement.nvl(dummy,my_package.expensive_null(value_in => dummy))

guidelines/guideline_4240_38.sql overview

Issue#LineSeverityMessageCode Excerpt
19CriticalG-4240: Always use a CASE instead of a NVL2 command if parameter 2 or 3 of NVL2 is either a function call or a SELECT statement.nvl2(dummy,my_package.expensive_nn(value_in => dummy) ,my_package.expensive_null(value_in => dummy))

guidelines/guideline_4250_na.sql overview

Issue#LineSeverityMessageCode Excerpt
118MajorG-4250: Avoid using identical conditions in different branches of the same IF or CASE statement.constants_up.co_red

guidelines/guideline_4260_na.sql overview

Issue#LineSeverityMessageCode Excerpt
111MinorG-4260: Avoid inverting boolean conditions with NOT.not l_color

guidelines/guideline_4270_na.sql overview

Issue#LineSeverityMessageCode Excerpt
113MinorG-4270: Avoid comparing boolean values to boolean literals.l_is_valid = true

guidelines/guideline_4325_na.sql overview

Issue#LineSeverityMessageCode Excerpt
114MajorG-4325: Never reuse labels in inner scopes.<<my_label>>

guidelines/guideline_4330_41.sql overview

Issue#LineSeverityMessageCode Excerpt
121MinorG-4330: Always use a CURSOR FOR loop to process the complete cursor results unless you are using bulk operations.fetch c_employees into r_employee

guidelines/guideline_4340_42.sql overview

Issue#LineSeverityMessageCode Excerpt
127MinorG-4340: Always use a NUMERIC FOR loop to process a dense array.i > t_employees.count()

guidelines/guideline_4350_43.sql overview

Issue#LineSeverityMessageCode Excerpt
118MajorG-4350: Always use 1 as lower and COUNT() as upper bound when looping through a dense array.t_employees.first()..t_employees.last()

guidelines/guideline_4360_44.sql overview

Issue#LineSeverityMessageCode Excerpt
128MinorG-4360: Always use a WHILE loop to process a loose array.1..t_employees.count()

guidelines/guideline_4365_na.sql overview

Issue#LineSeverityMessageCode Excerpt
113MajorG-4365: Never use unconditional CONTINUE or EXIT in a loop.continue process_employees

guidelines/guideline_4390_49.sql overview

Issue#LineSeverityMessageCode Excerpt
123MajorG-4390: Avoid use of unreferenced FOR loop indexes.for i in co_lower_bound..co_upper_bound loop sys.dbms_output.put_line(l_row || co_delimiter || l_value); l_row := l_row + co_row_incr; l_value := l_value + co_value_incr; end loop for_loop

guidelines/guideline_4395_50.sql overview

Issue#LineSeverityMessageCode Excerpt
112MinorG-4395: Avoid hard-coded upper or lower bound values with FOR loops.1..5

guidelines/guideline_5020_51.sql overview

Issue#LineSeverityMessageCode Excerpt
118CriticalG-5020: Never handle unnamed exceptions using the error number.when others then if sqlcode = co_no_data_found then null; end if;

guidelines/guideline_5040_53.sql overview

Issue#LineSeverityMessageCode Excerpt
121MajorG-5040: Avoid use of WHEN OTHERS clause in an exception section without any other specific handlers.when others then my_package.some_further_processing();

guidelines/guideline_5050_55.sql overview

Issue#LineSeverityMessageCode Excerpt
118MajorG-5050: Avoid use of the RAISE_APPLICATION_ERROR built-in procedure with a hard-coded 20nnn error number or hard-coded message.raise_application_error(-20501,'Invalid employee_id')

guidelines/guideline_5070_57.sql overview

Issue#LineSeverityMessageCode Excerpt
116CriticalG-5070: Avoid using Oracle predefined exceptionsraise no_data_found

guidelines/guideline_6010_58.sql overview

Issue#LineSeverityMessageCode Excerpt
111MajorG-6010: Always use a character variable to execute dynamic SQL.execute immediate 'select employees_seq.nextval from dual' into l_next_val

guidelines/guideline_7140_63.sql overview

Issue#LineSeverityMessageCode Excerpt
119MajorG-7140: Always ensure that locally defined procedures or functions are referenced.function my_func return number

guidelines/guideline_7210_65.sql overview

Issue#LineSeverityMessageCode Excerpt
19MinorG-7210: Try to keep your packages small. Include only few procedures and functions that are used in the same context.example_pkg

guidelines/guideline_7310_69.sql overview

Issue#LineSeverityMessageCode Excerpt
19MinorG-7310: Avoid standalone procedures – put your procedures in packages.my_procedure

guidelines/guideline_7320_70.sql overview

Issue#LineSeverityMessageCode Excerpt
120MajorG-7320: Avoid using RETURN statements in a PROCEDURE.return

guidelines/guideline_7410_71.sql overview

Issue#LineSeverityMessageCode Excerpt
19MinorG-7410: Avoid standalone functions – put your functions in packages.my_function

guidelines/guideline_7440_74.sql overview

Issue#LineSeverityMessageCode Excerpt
19MajorG-7440: Never use OUT parameters to return values from a function.out_date out date

guidelines/guideline_7450_75.sql overview

Issue#LineSeverityMessageCode Excerpt
111MajorG-7450: Never return a NULL value from a BOOLEAN function.return null

guidelines/guideline_7510_76.sql overview

Issue#LineSeverityMessageCode Excerpt
112MajorG-7510: Always prefix Oracle supplied packages with owner schema name.dbms_output.put_line(co_hello_world)

guidelines/guideline_7730_na.sql overview

Issue#LineSeverityMessageCode Excerpt
117MinorG-7730: Avoid multiple DML events per trigger.insert or update on departments

guidelines/guideline_8110_78.sql overview

Issue#LineSeverityMessageCode Excerpt
115MajorG-8110: Never use SELECT COUNT(*) if you are only interested in the existence of a row.count(*)

guidelines/guideline_8210_79.sql overview

Issue#LineSeverityMessageCode Excerpt
119MajorG-8210: Always use synonyms when accessing objects of another application schema.oe.products

guidelines/guideline_8510_na.sql overview

Issue#LineSeverityMessageCode Excerpt
112MajorG-4385: Never use a cursor for loop to check whether a cursor returns data.for emp_rec in ( select employee_id from employees order by employee_id ) loop null; -- some processing end loop employees