SQLPlus Variable

VARIABLE Command Syntax:

VAR[IABLE] [variable [NUMBER|CHAR|CHAR (n [CHAR|BYTE])|NCHAR|NCHAR (n)
|VARCHAR2 (n [CHAR|BYTE])|NVARCHAR2 (n)|CLOB|NCLOB|REFCURSOR]]

VARIABLE Command Examples:
VARIABLE id NUMBER
VARIABLE text CHAR (20)
VARIABLE var REFCURSOR

SET AUTOPRINT ON
VARIABLE var REFCURSOR
BEGIN
OPEN :var FOR SELECT id, name, city, email
FROM customers_details_view
WHERE id > 5000
ORDER BY name;
END;
/