Nov 05, 2012 10:41 AM|Lannie|LINK
If this is going to be in PL/SQL
then look into the concept of CURSOR as a surrogate for temporary data structure.
also read about Oracle Analytics and you might find functionality that lets you avoid using CTE completely.
Oracle Analytics and Oracle Model allow you to treat data sets / tables like spreadsheets to do dynamic calculations.