Мне нравится ответ Питера, но, в зависимости от того, что вам нужно сделать, вы можете искать оператор TRY, CATCH, FINALLY.
TRY
// Try to do something with the table
select top 1 'file exists' from "non_existing_table";
CATCH ADS_SCRIPT_EXCEPTION
// If a "7041 - File does not exist" error ocurrs
IF __errcode = 7041 THEN
// Do something else
select 'file does not exist' from system.iota;
ELSE
// re-raise the other exception
RAISE;
END IF;
END TRY;