I need to use a udf in stored procedure. Since Redshift needs either a temp table or a cursor to use the select statement inside the stored procedure, I chose to use temp table.