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
vit_Rakesh@yahoo.co.in
Messages: 1
Registered: September 2007
Junior Member
hi,
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.
declare
pi constant number := 3.14;
r number;
i number;
ar number(12,2);
begin
i := 1;
while i <= 3
loop
r := &radius;
ar := pi * power(r,2);
insert into areatab1 values(r,ar);
i := i + 1;
end loop;
end;
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
Frank
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 Dec 09 19:36:53 CST 2016

Total time taken to generate the page: 0.18389 seconds