You're getting a cartesian product in the second sth definition. You need to have something in your where clause that relates podetail and poheader (like in the first sth definition).
Aside from the cartesian issue that rdfield and derby note, you might also get a speed increase by using prepare_cached or moving the second prepare outside the foreach loop so that you're not (re)prepareing the same statement over and over (especially silly when you go to the trouble of using placeholders!).