Sidebar

HPL/SQL is included to Apache Hive since version 2.0

select-into

SELECT INTO Statement

SELECT INTO statement allows you to assign values to variables using a SQL SELECT query.

Example:

DECLARE cnt INT = 0;
SELECT COUNT(*) INTO cnt FROM users;
PRINT 'Users: ' || cnt; 

Compatibility: Oracle, IBM DB2, Teradata, PostgreSQL, MySQL and Netezza.

Version: HPL/SQL 0.1

See also: