I am making this program that will have a menu that gets the user's input and performs a certain script based on his/her choice. Something along the lines of:
Please make a selection: 1: Do script a 2: Do script b 3: Do script c
I looked at this link : How to make SQLPlus or PL/SQL Menu
And I was able to get something out of it, BUT it's not fully functional. Because there are certain lines I don't understand. See below.
PROMPT 1: Make a sales invoice PROMPT 2: Inquire a sales invoice accept selection PROMPT "Enter option 1-2: "
set term off
column script new_value v_script -- What's column script?
select case '&selection.'
when '1' then '@test.sql'
when '2' then '@test.sql'
else '@FinalAssignment.sql'
end as script -- What script is this referring to?
from dual; -- Don't know this
set term on
@&v_script. -- What script is being ran here?
I can get the program to run the scripts, BUT the else doesn't really work. If I pick a number outside that range the script will close, instead of reloading itself. Also when a script is ran it closes itself, instead of going back to the main menu. I know I have to run a loop to fix this problem, BUT I don't know how to implement it in this language it.
Any help is appreciated it. Thanks!