← PL/SQL Topics
Language Basics
Explain PL/SQL variable declarations and data types (NUMBER, VARCHAR2, DATE, BOOLEAN, etc.)
Variables and Data Types
Oracle Fusion / EBS · Technical · PL/SQL
GeneralHigh confidence
Variables are declared in the DECLARE section with a datatype and optional default value.
Grounded in: Curated Oracle knowledge layer — PL/SQL
How it works
Declare variables in the DECLARE section with a datatype and optional default via := or DEFAULT. Common scalar types are NUMBER, VARCHAR2(n), DATE, and BOOLEAN (a PL/SQL-only type — no SQL column can be BOOLEAN). A variable declared NOT NULL must be given an initial value at declaration time.
How it works
DECLARE v_employee_id NUMBER := 100; v_last_name VARCHAR2(50) := 'King'; v_hire_date DATE := SYSDATE; v_is_active BOOLEAN := TRUE; BEGIN DBMS_OUTPUT.PUT_LINE(v_last_name || ' hired on ' || TO_CHAR(v_hire_date, 'DD-MON-YYYY')); END; /
Related Questions
Have a follow-up, or a different question?
Continue in Ask Oracle AI