oracle - how to force user to enter value for substitution variable? -


i have script sqlplus form. ask user enter values substitution variables execute insert statement.

some substitution variables used mandatory columns,

how can ask user fill again if substitution variable value null?

how assign value same substitution variable depending on it's value forcing user enter it?

or how force user enter value substitution variable ?

something like

psedu code:  accept x prompt please enter value x  while (&x null) loop        accept x prompt please enter value x  end loop insert ... 

is possible

this crazy but... based on this answer gave question can create script called main.sql this:

accept x prompt please enter value x accept y prompt please enter value y accept z prompt please enter value z  set term off verify off  column script new_value v_script  select case when '&&x.' null or '&&y.' null or '&&z.' null          'main'          else 'do_insert'           end script   dual;  set term on verify on  @@&v_script. 

then create script called do_insert.sql this:

insert mytable (a, b, c) values ('&&x.', '&&y.', '&&z.'); 

the main.sql script keep re-running until of x, y , z not null - making user re-enter of them each time. once not null, run do_insert.sql uses values.

note each time main.sql re-run nested call; sql developer (for example) fails error if user keeps omitting values:

sp2-0309: sqlcl command procedures may nested depth of 20.

but really, if want decent user interface, sql plus scripts not way build one.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -