Put the whole of select expression within brackets in decode function. Syntax will then be right.