x
CREATE TABLE areas
(
radius NUMBER(7),
area NUMBER(7,2)
)
--- I have created pl/sql program to input radius, calculate area and insert values into areas table, the starting radius can be 3---
declare pi CONSTANT NUMBER(4,2) :=3.14;
radius NUMBER(4);
area NUMBER(5,2);
BEGIN
radius:=3;
WHILE radius <=7
LOOP
area := pi*Power(radius,2);
INSERT INTO areas VALUES (radius,
area)
radius := radius+1
END LOOP;
END;
Advertisement
Answer
In your code you are missing the semicolon in insert statement & radius value assignment statement –
declare pi CONSTANT NUMBER(4,2) :=3.14;
radius NUMBER(4);
area NUMBER(5,2);
BEGIN
radius:=3;
WHILE radius <=7
LOOP
area := pi*Power(radius,2);
INSERT INTO areas VALUES (radius,
area);
radius := radius+1;
END LOOP;
END;