This is an issue for many developers. I see a lot of questions and receive a lot of mails on this topic. I thought that demonstrating how to do that with two items would be enough to guess how to do it with more than that, since the approach is the same. However, there is nothing better than a step by step guide to get it working.
You will find the extended example here:
My advice, from what I have seen so far debuging the other people examples, is to:
1. be carefull with copy-paste and before you do it, think of replacing the given item , table and procedure names with your own,
2. test your on-demand processes in the SQL workshop first, to see if they run,
3. avoid multiplying your code through copy-paste. This makes it much easier to debug and
4. if you have no experience with a similar solution, try to reduce your scope and do it on a simple example first. Try using emp, dept tables like I do it in my Demo Application.