User Tools

Site Tools


**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]]


====== CREATE LOCAL TEMPORARY TABLE ====== CREATE LOCAL TEMPORARY TABLE statement allows you to create a temporary table for the current session. **Syntax**: <code language=sql> CREATE LOCAL TEMPORARY TABLE table_name ( column_name data_type [NULL | NOT NULL] [, ...] ) [ ON COMMIT DELETE ROWS | ON COMMIT PRESERVE ROWS] </code> Notes: * The local temporary table is automatically dropped at the end of session. For more details how temporary table support is implemented in HPL/SQL, 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 hplsql.temp.tables = managed; CREATE LOCAL TEMPORARY TABLE temp1 ( c1 INT, c2 STRING ); INSERT INTO temp1 SELECT 1, 'A' FROM dual; SELECT * FROM temp1; </code> **Compatibility:** ANSI SQL **Version**: HPL/SQL 0.3.1 See also: * [[temporary-tables|Native and Managed Temporary Tables]] * [[create-volatile-table|CREATE VOLATILE TABLE]] * [[declare-temporary-table|DECLARE TEMPORARY TABLE]] ~~NOTOC~~