PL/SQL package for password generation and strength checking
PL/SQL Package: Exercise-5 with Solution
Write a PL/SQL code to create a package that includes a procedure to generate a random password and a function to check the password strength based on certain criteria.
Sample Solution:
PL/SQL Code:
Sample Output:
Package created. Package Body created.
Flowchart:
To execute the package:
Sample Output:
Statement processed. Generated Password: VCDOwPxyr4 Password Strength: Strong
Flowchart:
Explanation:
The said code in Oracle's PL/SQL package that offers functionality for password generation and strength checking.
The PL/SQL package that consists of two main components the GenerateRandomPassword procedure and the CheckPasswordStrength function.
An uppercase, lowercase, and digit character set is used to generate a random password using the GenerateRandomPassword procedure and throws an exception if the length provided is less than or equal to zero.
CheckPasswordStrength checks a password's strength by making sure that it contains at least one uppercase, one lowercase, and one digit, and that it has at least eight characters.
Passwords that meet the said criteria will be rated as "Strong", while passwords that don't will be rated as "Weak".
A proper error message is provided for both the procedure and the function when exceptions occur.
Previous: Math operations package in PL/SQL.
Next: PL/SQL Package for date calculation and format conversion.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics