Write A PL
Write A PL
Write A PL
sql>ed <filename> //to open a file Q. Set Serveroutput on Declare x number := &x; s number; Begin s := x*x; Dbms_output.put_line('Square of'||x||'='||s); end; sql>@<filename> //to run the PL/SQL block
Write a PL/SQL block to compute the area of the circle and square.
Q. Set Serveroutput on Declare r number(5,2) := &r; s number(5,2) := &s; ca number(5,2); sa number(5,2); Begin ca := (3.14)*r*r; sa := s * s; Dbms_Output.put_line('area of circle='||ca); Dbms_Output.put_line('area of square='||sa); End; /
dbms_output.put_line('total='||total); dbms_output.put_line('average='||avge); if(avge<50) then dbms_output.put_line('Fail'); elsif(avge>=50 or avge<60) then dbms_output.put_line('Second division'); elsif(avge>=60 or avge<75) then dbms_output.put_line('First division'); elsif(avge>=75) then dbms_output.put_line('Distinction'); end if; end; /