In: Computer Science
Create a PL/SQL anonymous block that uses a nested loop (inner loop 1 to 15; outer loop 1 to 5) to perform computations using the SQL functions, ABS, EXP, SQRT, ROUND, MIN, MAX, LOG, MOD, REMAINDER and POWER
The outer loop will use the functions, ABS, EXP, SQRT, ROUND to display the following messages (must be
The inner loop will use the functions, MIN, MAX, LOG, MOD, REMAINDER and POWER, to display the following messages,
Refer to the "Numeric Functions" section of the SQL Reference section (link in Announcements) for descriptions and use of all the functions
Coding:
DECLARE
i number(3);
j number(3);
log_val number(7,2);
BEGIN
i := 1;
LOOP
/* here is outloop */
dbms_output.put_line('****************************************');
dbms_output.put_line('The absolute value of ::'||i||' is
'||abs(i));
dbms_output.put_line('The value of e to the ::'||i||'
is '||exp(i));
dbms_output.put_line('The square root of ::'||i||' is
'||sqrt(i));
dbms_output.put_line('The rounded value of ::'||i||'
is '||round(sqrt(i)));
dbms_output.put_line('****************************************');
j:= 1;
LOOP
/* here is inner loop */
dbms_output.put_line('****************************************');
dbms_output.put_line('The minimum of value of ='||i||' and '||j||'
is ='||least(i,j));
dbms_output.put_line('The Maximum
of value of ='||i||' and '||j||' is ='||GREATEST(i,j));
dbms_output.put_line('The Log of
base of ='||i||' and '||j||' is ='||log(2,3));
dbms_output.put_line('val :'||i||' mod '||j||' is
='||mod(i,j));
dbms_output.put_line('val :'||i||' mod '||j||' is
='||mod(i,j));
dbms_output.put_line('val :'||i||'
power is '||j||' is ='||power(i,j));
j := j +1;
exit WHEN j=5;
END LOOP;
i := i +
1;
exit WHEN i = 15;
END LOOP;
END;
/
output:
if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........