Question: Part 1 Sql Data modeling (1) Dissect the following code by putting comment statements for every line! ( Use the double hyphen to have the
Part 1 Sql Data modeling
(1) Dissect the following code by putting comment statements for every line! ( Use the double hyphen to have the server ignore the comments. Refer to the example given for the variable num1 to get you started ) .
DECLARE
num1 data_table.n1%TYPE; -- declare the variable num1
num2 data_table.n2%TYPE; --
num3 data_table.n3%TYPE; --
result temp.col1%TYPE;
CURSOR c1 IS
SELECT n1, n2, n3 FROM data_table WHERE exper_num = 1;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO num1, num2, num3;
EXIT WHEN c1%NOTFOUND; -- TRUE when FETCH finds no more rows
result := num2/(num1 + num3);
INSERT INTO temp VALUES (result, NULL, NULL);
END LOOP;
CLOSE c1;
COMMIT;
END;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
