whenever sqlerror exit has the same parameters as the ordinary exit command.
Exit SQL*Plus as soon as an error is encountered (but print the error message):
whenever sqlerror exit
select q'[This statement is executed]' txt from dual;
select 1 from "no such table";
select q'[This statement won't be executed]' txt from dual;