I have a complex query that creates a master CTE_Table form other CTE_Tables. I want to insert the results of the master CTE_Table into a physical table. I'm using Teradata version 15.10.04.03
SELECT Failed. [3707] Syntax error, expected something like a 'SELECT' keyword or '(' or a 'TRANSACTIONTIME' keyword or a 'VALIDTIME' keyword between ')' and the 'INSERT' keyword.
DROP TABLE dbname.physicalTablename ;
CREATE MULTISET TABLE dbname.physicalTablename , NO FALLBACK , NO BEFORE JOURNAL, NO AFTER JOURNAL, CHECKSUM = DEFAULT, DEFAULT MERGEBLOCKRATIO ( col1 INTEGER, col2 INTEGER, col3 INTEGER ) NO PRIMARY INDEX ;
WITH
cteTable3 AS ( SELECT A.colA, A.colB, A.colC, B.col1, B.col2, B.col3 FROM cteTable1 A INNER JOIN cteTable2 ON (blah blah blah) ),
cteTable2 AS ( SELECT col1, col2, col3 FROM SourceTableB ),
cteTable1 AS ( SELECT colA, colB, colC FROM SourceTableA )
INSERT INTO dbname.physicalTablename
( col1, col2, col3, col4, col5, col6 )
SELECT
(C3.colA, C3.colB, C3.colC, C3.col1, C3.col2, C3.col3)
FROM cteTable3 C3 ;
INSERT
keyword in your code. Did you share the wrong thing? – JNevill