DECLARE variable like ROWTYPE in Teradata

Database

DECLARE variable like ROWTYPE in Teradata

How implementation in TERADATA "ROWTYPE"

Sample in ORACLE:
Declare
v_emp emp%ROWTYPE;

Thanks for help
Tomek_123
2 REPLIES
Teradata Employee

Re: DECLARE variable like ROWTYPE in Teradata

Hello,

You can use volatile/temporary tables instead.

Regards,

Adeel
Enthusiast

Re: DECLARE variable like ROWTYPE in Teradata

Hello,

%ROWTYPE in Oracle creates a structured variable with the same structure as the table definition it references. It can hold the equivalent of 1 row at a time when used as a fetch target for a cursor. Volatile tables in Teradata appear to be analogous to Oracle temporary tables, not %ROWTYPE.

Here's my Teradata scenario:
- Reviewing a procedure to perform complex processing on data as part of an ETL process
- It uses a series of CURSORs to fetch and process data, tables have dozens of columns each
- as a result, the Teradata code declares hundreds of local variables to FETCH into.

Is there a way I can reduce these hundreds of variables into a handful of %ROWTYPE -like declarations?
If not %ROWTYPE, can I create my own stuctured datatype to match the cursor's result structure?

I'm experience with Oracle PL/SQL but new to Teradata, so I would appreciate an example if applicable.

Thanks in advance,
Rich