Minus vs Except Difference in ORACLE/SQL Server Minus vs Except Difference in ORACLE/SQL Server oracle oracle

Minus vs Except Difference in ORACLE/SQL Server


This will check for any result set from the first query, then run the except if there is a result. If not it only runs the second query.

IF EXISTS (SELECT NULL           FROM ... <first query criteria>           WHERE ...)BEGIN    SELECT ... <first query>    EXCEPT     SELECT ... <second query>ENDELSESELECT ... <second query>