The sql plugin does have limitations, It will not accept long sql statements, therefore you have to break the statement into several, while passing the previously received variable to the next and so on.
Depending on what database you use (I use Foxpro), you can query the database for the number of rows for the result. For example I use "select count (*) from..." If the record exists, it displays "1", else it gives "0" I use that to go to the appropriate OGM.
This is very useful, because many times the caller will enter an invalid number, I use the "count (*) function to check for that, and redirect them to the OGM that prompts them to re-enter their data.
Hope this helps