I'd like to use a bind variable value as input prompt in a SQL*Plus script. Here's what I've tried:
1) I defined the bind variable as follows
SQL>var prompt varchar2(100)
2) and assigned a value using PL/SQL
SQL>exec select 'your name' into :prompt from dual
3) now I can PRINT or select the bind variable value as follows:
SQL>select :prompt from dual;
:PROMPT
------------------------------------
your name
SQL>print prompt
PROMPT
------------------------------------
your name
4) now I'd like to have "your name" being shown as ACCEPT prompt but I don't know how that can be achieved:
SQL>accept input prompt 'prompt'
prompt
SQL>accept input prompt ':prompt'
:prompt
5) would I be able to assign the bind value back to a substitution variable, it could be done like that:
SQL>define prompt = 'your name subst'
SQL>accept input prompt '&prompt.>'
your name subst>Bob
SQL>def input
DEFINE INPUT = "Bob" (CHAR)
The only way I see this could be done is SPOOLing into a temp.sql file and running this using @temp.sql but this seems like a terrible hack