Skip to content
Advertisement

Redshift UDF function with dynamic SQLstatement

I am very much new to Amazon redshift. I am trying to create the UDF function to create column aggregation by adding multiple columns, here is what I am tried

Errors I am getting near return statement. I am sure there is something wrong with syntax. I want to pass the indentifer as parameter based on parameter I want to add columns.

Advertisement

Answer

You need to use a stored procedure to perform dynamic SQL. See “Overview of Stored Procedures in Amazon Redshift”

See also this previous answer: Redshift: Executing a dynamic query from a string

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement