You can use explicit cursors, contactenate them in each iteration of the Loop. What say? I am afraid whether DECODE can help to do this in a single SELECT statement.