HPL/SQL is included to Apache Hive since version 2.0
This is an old revision of the document!
DECLARE TEMPORARY TABLE statement allows you to define a temporary table for the current session.
DECLARE [GLOBAL] TEMPORARY TABLE table_name ( column_name data_type [NULL | NOT NULL] [, ...] ) [ ON COMMIT DELETE ROWS | ON COMMIT PRESERVE ROWS]
The following options are supported for compatibility with other databases:
IN tablespace_name WITH REPLACE DISTRIBUTE BY HASH (col, ...) LOGGED | NOT LOGGED
For more details how temporary table support is implemented in PL/HQL, see Native and Managed Temporary Tables.
Create a managed temporary table and use it in other SQL statements:
SET plhql.temp.tables = managed; DECLARE TEMPORARY TABLE temp1 ( c1 INT, c2 STRING ); INSERT INTO temp1 SELECT 1, 'A' FROM dual; SELECT * FROM temp1;
Compatibility: IBM DB2
Version: PL/HQL 0.03