Shefali Arora
Shefali Arora

Reputation: 1

Can I have table variable in stored procedure in redshift?

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.

Upvotes: 0

Views: 1557

Answers (1)

Joe Harris
Joe Harris

Reputation: 14035

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/"

Upvotes: 2

Related Questions