My Oracle Support Banner

How to Exit from SQL*Plus Script if Substitution Variable is not Defined (Doc ID 393476.1)

Last updated on NOVEMBER 20, 2019

Applies to:

SQL*Plus - Version and later
Information in this document applies to any platform.


Is it possible to exit from SQL*PLUS with a return code when an SQL is executed with an undefined variable within a Unix shell script.

select &var1 from dual; --var1 is not declared within the script


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.