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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!