Re: Any ideas regarding SQL procedure? A potential approach:
- Prepare a table that has rows with all level of interations that you'll
ever need, e.g. rows with values from 1 to 1000. Let's call this table
t_it (interations int not null).
- Instead of looping n times over the source table, you could then simply
join against that prepared table:
insert into target (id, iterations_counter)
select (source.id, it.interation)
from source, it
where source.id = p_id and it.iteration between 1 and p_iterations
You'll need to do this for all p_id's from your source table.
Jochen |