Last active
January 16, 2018 09:49
-
-
Save foobarbaz-pl/e2f6644dbd0e07559b290458a8cb4571 to your computer and use it in GitHub Desktop.
SQL*Plus Conditional Script Execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- activate substitution variables | |
set define on | |
-- suppress echo for substitution variables | |
set verify off | |
-- activate stdout | |
set serveroutput on | |
define _IF_MASTER_INSTANCE="--" | |
col master_instance new_value _IF_MASTER_INSTANCE noprint | |
select case | |
when sys_context('USERENV', | |
'DB_NAME') = 'ABCD' then | |
'script.sql' | |
else | |
'noop.sql' -- empty | |
end master_instance | |
from dual | |
/ | |
@&_IF_MASTER_INSTANCE | |
undefine _IF_MASTER_INSTANCE | |
col master_instance clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment