2011-09-13

Teradata - Temporary and volatile tables


-- 1. Global temporary.
create
      set global temporary
      table temp1
      , no fallback
      , no log
(
      deptno smallint
      ,avgsal dec(9,2)
      ,maxsal dec(9,2)
      ,minsal dec(9,2)
      ,sumsal dec(9,2)
      ,empcnt smallint
)
;


-- 2. Volatile.
CREATE
      VOLATILE TABLE
      table_name_here
AS
(
      SELECT
            '1001' as Field1
            , '2010/04/08' AS Field2           
)
WITH DATA PRIMARY INDEX ( Field1, Field2 )
ON COMMIT PRESERVE ROWS
;

No comments:

Post a Comment