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 10.1.0.4 and later
Information in this document applies to any platform.

Goal

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.

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


Solution

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
Goal
Solution


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