Home » SQL & PL/SQL » Client Tools » How to refresh variable in loop
How to refresh variable in loop [message #269921] Tue, 25 September 2007 02:22 Go to next message
Messages: 1
Registered: September 2007
Junior Member
can any one tell me that how to refresh variable r inside the loop so that it can ask for the value of variable r in each iteration. In this case only first time it is asking to enter value for r and in further iteration it is using same value of r.
pi constant number := 3.14;
r number;
i number;
ar number(12,2);
i := 1;
while i <= 3
r := &radius;
ar := pi * power(r,2);
insert into areatab1 values(r,ar);
i := i + 1;
end loop;
Re: How to refresh variable in loop [message #269922 is a reply to message #269921] Tue, 25 September 2007 02:25 Go to previous message
Messages: 7880
Registered: March 2000
Senior Member
You can not.
You are asked for a value of r once, when sqlplus interprets the block prior to sending it to the server.
Then it is execute as an atomic block on the server, without (possibility to) interact during the run.
Previous Topic: SQL*Plus Script Dropping Column Headings
Next Topic: sqlplus
Goto Forum:

Current Time: Fri Apr 28 23:00:35 CDT 2017

Total time taken to generate the page: 0.10182 seconds