HPL/SQL is included to Apache Hive since version 2.0
This is an old revision of the document!
You can declare variables using DECLARE block or statement.
Note that you can mix both syntaxes in a single program. DECLARE blocks and statements can appear in any part of the program.
DECLARE block has the following syntax:
DECLARE var datatype [NOT NULL] [:= | = | DEFAULT expression]; ...
DECLARE code CHAR(10); status INT := 1; count SMALLINT = 0; limit INT DEFAULT 100;
Compatibility: Declaration block syntax is similar to Oracle PL/SQL, PostgreSQL PL/pgSQL and Netezza NZPLSQL.
DECLARE statement has the following syntax:
DECLARE var [, var2, ...] [AS] datatype [:= | = | DEFAULT expression] [, ...];
DECLARE code CHAR(10); DECLARE status, status2 INT DEFAULT 1; DECLARE count SMALLINT, limit INT DEFAULT 100;
Compatibility: Declaration statement syntax is similar to IBM DB2 SQL PL, Teradata, Microsoft SQL Server Transact-SQL and MySQL.