I have several scripts that I would like to start from a menu presented to the SQLPlus user. Something like:
Please make a selection:
1: Do script a
You can execute scripts from a master script:
CASE LOWER(&v_script_selection)
WHEN 'a' THEN
@script_a.sql
WHEN 'b' THEN
@script_b.sql
WHEN 'c' THEN
@script_c.sql
ELSE
DBMS_OUTPUT('No such option available')
END
&variablename
is used to refer to the variable variablename
in SQLPlus, much the same way $variablename
is used in shell scripts. If variablename
is undefined, then SQLPlus prompts the user for a value.
You can provide a path relative to the master script - the example relies on the supporting scripts to be in the same directory.