With no error message, no idea about your database objects and data, it is difficult to comment as to what the problem might be. Try running that sql inside decode and see if that returns what you want. Debug the sqls individually before you put decode with them. Paste here what you are actually trying to do. Pasting sample of your data and what you expect might help a lot.

Thanks