G-2340
🆓Error
Always define your VARCHAR2 variables using CHAR SEMANTIC (if not defined anchored).
Reason
Changes to the nls_length_semantic
will only be picked up by your code after a recompilation.
In a multibyte environment a varchar2(10)
definition may not necessarily hold 10 characters when multibyte characters are part of the value that should be stored, unless the definition was done using the char
semantic.
Example
Non-Compliant Example
create or replace package types_up is subtype description_type is varchar2(200); end types_up; /
Issues
Line | Column | Message |
---|---|---|
2 | 32 |
★★★★★
Compliant Solution -
create or replace package types_up is subtype description_type is varchar2(200 char); end types_up; /
References
- similar to plsql:NcharByteLengthUsageCheck
The scope of plsql:NcharByteLengthUsageCheck is NCHAR and NVARCHAR2.
- same as Trivadis G-2340