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

SELECT INTO Global Temporary Table within Stored Procedure using dynamic SQL - forum topic by cochetti

$
0
0

Hi there, I'm pretty new to the forums so if this is answered elsewhere feel free to point me in the right direction.
I am trying to create flexible stored procedures which take strings that correspond with dbname.table/viewname and then compare them to user input volatile tables and then output them into a new volatile table.  Here's a sample call:
REPLACE PROCEDURE DCC_PROC_LIB.Calc_Birthdate ( IN tblINPUT VARCHAR(250), IN tblsourceforbirthdatesVARCHAR(250) NOT CS, IN tblOUTPUT VARCHAR(250))
The problem I am running into is that I would like to store the information in a global temporary table so when I have another procedure call the function it can use the GTT produced by this and alter it.  I use dynamic SQL to handle the user input aspect. I am getting an error that "SQL statement is not supported within a stored procedure" when I use an INSERT INTO the GTT. 
I see that SELECT INTO is supported within stored procedures but can't seem to find the proper syntax to execute this.

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>