Archives of the TeradataForum
Message Posted: Thu, 13 Feb 2003 @ 13:57:52 GMT
| Subj: || || Re: Looking for sample Stored Procedure |
| From: || || Geoffrey Rommel |
| ||I would like to create a stored procedure that will read inputs from one table and pass these as variables into an sql statement that
updates a table. It would move through the variable table until all values have been passed into the sql and the destination table has been
I'd turn back if I were you.
In Teradata, stored procedures are needed only in unusual circumstances. I think you'll find that straight SQL is easier to code and
Here are two techniques that may be appropriate for what you're doing.
set target_table.col5 = source_table.col5,
target_table.col6 = source_table.col6, ... /* etc. */
where target_table.col1 = source_table.col1
and target_table.col2 = source_table.col2 ... /* etc. */
insert into brand_new_table
select s.old_data, t.new_data, ...
from source_table s,
where s.col1 = t.col1
and s.col2 = t.col2 ...;