Master the Basics of PL/SQL Variables.
Understanding how to declare, initialize, and manage variables is the first real step toward becoming a strong Oracle PL/SQL Developer.
Attached is a easy-to-follow visual guide covering:
✅ What are variables
✅ Naming conventions
✅ Guidelines for declaring
✅ Keywords used during initialization (:=, DEFAULT, NOT NULL)
✅ Valid combinations and common pitfalls (like PLS-00218 error)
Keywords Used During Variable Initialization:
1. :=
Assign a value directly
Example v_salary NUMBER := 50000;
2. DEFAULT
Set a default value
Example v_bonus NUMBER DEFAULT 1000;
3. NOT NULL
Enforce non-nullability (must initialize)
Example v_id NUMBER NOT NULL := 101;
4. CONSTANT
Make the variable a constant (fixed value) — must initialize at declaration
Example c_tax_rate CONSTANT NUMBER := 18;
Save it, share it, or bookmark it for quick revision.

Comments
Post a Comment