Why you should care
Specify precision which is the total number of digits, and scale, which is the number of digits to the right of the decimal point. The range of a Char variable is from 1 to 32767 bytes. When the expression falls outside this range, it is no longer precise and a numeric overflow or undeflow error occurs.
Business Impacts
It is recommended to specify precision as it helps alleviate potential risks in the code and ensure that the code is reliable and accessible
CAST Recommendations
References
https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/datatypes.htm
https://docs.oracle.com/cd/A97630_01/appdev.920/a96624/03_types.htm
https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/datatypes.htm#i43252
https://stackoverflow.com/questions/1171196/what-is-the-difference-between-varchar-and-varchar2
How we detect
This code insight shows that char-based variable must always be declared.
About CAST and Highlight’s Code Insights
Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.