Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Use of CTE within stored procedures - response (1) by M.Saeed Khurram

$
0
0

It is strange that this SQL works fine in SQL-Assistant, but when called througha procedure throws error. I have checked with recursive CTE as well, but it throws the same error. 
But it works fine the usual derived table syntax, as follows

REPLACE MACRO with_test_proc AS 
(
  
       INSERT
         INTO
              with_target
            (
                b
            )
            SELECT b
            FROM
            (
                  SELECT
                         1 b
                    FROM
                         with_source
            ) tmp
            UNION
            SELECT
              b + 1
              FROM
            (
                  SELECT
                         1 b
                    FROM
                         with_source
            ) tmp
            ;
);

Can it help you scenario?
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles