PLSQL replacement for IIF

Currently I am using a Oracle database and have been writing queries and can across a problem the other day, I wanted to use a IIF statement which I have used in other SQL based databases like Sybase Advantage. However PLSQL does not support IIF statements, but the workaround I found was to use the DECODE function instead, for example:

Decode(:param1, -1, dothis, dothat)

Not sure how fast this executes compared with IIF, but the query executed very fast.

Leave a Reply

You must be logged in to post a comment.