Can I have table variable in stored procedure in redshift?

1.2k views Asked by At

We are planning to create a procedure for our logic what should be in PL SQL in redshift (using workbench). Can we use a table variable to traverse through the rows of the table ? Like we have dataframe in Python.

1

There are 1 answers

2
Joe Harris On

Sort of. Redshift implements a RECORD data type for stored procedures. Variables with this type can hold an arbitrary sets of rows.

However, note that you cannot currently SELECT from a RECORD typed variable, only loop over the content.

There are several examples of using a RECORD variable in our GitHub repository: "amazon-redshift-utils/src/StoredProcedures/"