Search notes:

SQL*Plus: VARIABLE

variable declares a bind variable (see also here) which then can be used in SQL Statements or (anonymous) PL/SQL blocks.
When declaring a bind variable, its datatype must be stated, otherwise SQL*Plus throws a SP2-0552: Bind variable … not declared. error.
The current value of the bind variable can be shown with print.
variable num number
exec :num := 42
print num
var  last_create_time varchar2(19)
begin
   select
      to_char(max(created), 'yyyy-mm-dd hh24:mi:ss') into :last_create_time
   from
      user_objects;
end;
/

begin
   dbms_output.put_line('Last creation time: ' || :last_create_time);
end;
/

Datatypes

A bind variable can be set to one of the following data types:
There is no date datatype!

See also

Using variables in SQL*Plus.
SQL*Plus

Index