I have the following pl/sql block:
BEGIN
FOR I IN 1 .. 5
LOOP
INSERT INTO TEST_TABLE VALUES('&slno',SYSDATE);
END LOOP;
END;
When I executed the above block it is taking only one input.
But it is supposed to take 5 input in total.
What is missing in my code? Can any one help me please?
It is a substitution variable – an sql*plus feature – and it doesn’t work this way. You have to call
undefine &slnooraccept slno ...to make it take another input, but these are also sqlplus, not pl/sql commands, so you won’t be able to invoke them in a loop,Probably the only thing you can do here is
update: Fortunately, you can work this around by generaing a list of separate sequential statements accepting independent inputs: