How to create a temp table in teradata

3.7k views Asked by At
BEGIN;
CREATE TEMP FACT TABLE new_table  DISTRIBUTE BY hash(a.var3) as
SELECT (YEAR(a.var1) - b.var2), a.var3
FROM d.data1 a, c.data2 b
WHERE (YEAR(var1) - var2) > 40
;

GO
SELECT * FROM age_DRG;
END;

I am not sure what is wrong with this code. I keep getting this error

"Executed as Single statement.  Failed [34 : HY000] [AsterData][ASTERJDBCDSII](34) NOTICE: current transaction is aborted, queries ignored until end of transaction block () 
Elapsed time = 00:00:00.016 

STATEMENT 1: BEGIN;
CREATE Statement failed. "
1

There are 1 answers

0
r90t On
  1. There is no such function YEAR, you can use date_trunc('year', somedate) instead
  2. You do not need to use "FACT" keyword, Aster will understand it by distribution type
  3. dnoeth right, there is no GO keyword in Aster
  4. I would recommend you to use joins to be more precise, because Aster was designed to calculate data on worker side and, i think, joins will be more "readable" for Aster.