User Tools

Site Tools


Sidebar

**HPL/SQL is included to Apache Hive since version 2.0** * [[home|Home]]\\ * [[why|Why HPL/SQL]]\\ * [[features|Key Features]]\\ * [[start|Get Started]]\\ * [[doc|HPL/SQL Reference]]\\ * [[download|Download]]\\ * [[new|What's New]]\\ * [[about|About]]

declare-temporary-table

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== DECLARE TEMPORARY TABLE - PL/HQL ====== DECLARE TEMPORARY TABLE statement allows you to define a temporary table for the current session. **Syntax**: <code language=sql> DECLARE [GLOBAL] TEMPORARY TABLE table_name ( column_name data_type [NULL | NOT NULL] [, ...] ) [ ON COMMIT DELETE ROWS | ON COMMIT PRESERVE ROWS] </code> ==== Compatibility Options ==== The following options are supported for compatibility with other databases: **IBM DB2:** <code language=sql> IN tablespace_name WITH REPLACE DISTRIBUTE BY HASH (col, ...) LOGGED | NOT LOGGED </code> For more details how temporary table support is implemented in PL/HQL, see [[temporary-tables|Native and Managed Temporary Tables]]. **Example**: Create a managed temporary table and use it in other SQL statements: <code language=sql> SET plhql.temp.tables = managed; DECLARE TEMPORARY TABLE temp1 ( c1 INT, c2 STRING ); INSERT INTO temp1 SELECT 1, 'A' FROM dual; SELECT * FROM temp1; </code> **Compatibility:** IBM DB2 **Version**: PL/HQL 0.03 See also: * [[temporary-tables|Native and Managed Temporary Tables]] * [[create-local-temporary-table|CREATE LOCAL TEMPORARY TABLE]] * [[create-volatile-table|CREATE VOLATILE TABLE]] ~~NOTOC~~