|
Archives of the TeradataForumMessage Posted: Mon, 18 May 2009 @ 10:23:44 GMT
Macros are not well suited to what you are trying to do. You should consider looking at Stored Procedures. You should also consider the algorithm you are trying to implement. Many people write procedures that process data one row at a time (e.g. they use cursors). Such procedures do not perform well on Teradata for anything but small volumes of data because they do not leverage Teradata's parallel capabilities. Another factor to consider with SP's is that they can not currently return result sets. I believe this is addressed in TD 13, but not sure. So a lot of people use the procedure to populate a table (e.g. insert select) then once the procedure has completed, select * from the output table. If you were going to write your second query in a procedure, one way would be to split it into two parts. The fist is the select max query that places its result into a variable. Then use that variable in the second query which would insert its results into an output table (you might use a global temporary table for that). Then select * from the output table to see the results. Of course there are other ways of writing the query that is just one example. I hope this helps. Glenn Mc
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||