Unanswered: Command line parameters to plsql script
I wanted to insert 10 records in a table.
I wrote a plsql block with the insert statement in a loop that executes 10 times. The value for this insert statement is '&key' and '&val' these can be entered with the script prompts me.
But, plsql, while parsing prompts for the values only once.
And then executes the loop 10 times with these values.
For inserting 10 records, i found an alternative, which is manual.
Was interested in knowing if oracle has any feature that a plsql script prompts user for inputs for each time the loop is executed? I sincerely believe, there should be an approach to it which I dont know.
Server PL/SQL can't prompt for inputs at all - not even once! It was SQL Plus that prompted you for values for the substitution variables &key and &val, and made the substitutions before sending the PL/SQL block to the server. The server knows nothing about &key and &val.
You would need to write code in a more sophisticated client tool than SQL Plus (e.g. Oracle Forms, Pro*C, Visual Basic, ...) where you can write code with loops and prompt for user input within the loop.