Practical Practice 17

Oracle Practice

Write a program to enter P, T, R and calculate Simple Interest in PLSQL block.

Write a program to enter P, T, R and calculate Simple Interest in PLSQL block.

SOLUTION

--Static code

set serveroutput on;
DECLARE
   P NUMBER :=15000; 
   T NUMBER := 5; 
   R NUMBER(3,2) := 3.5; 
   SI NUMBER; 
BEGIN
       SI := (P * T * R) / 100;
      DBMS_OUTPUT.PUT_LINE('The Simple Interest is: ' || SI);
END;
/
    


--Dynamic code 
DECLARE
   P NUMBER :=&P; 
   T NUMBER := &T; 
   R NUMBER(3,2) := &R; 
   SI NUMBER; 
BEGIN
       SI := (P * T * R) / 100;
      DBMS_OUTPUT.PUT_LINE('The Simple Interest is: ' || SI);
END;
/

TRY IT YOURSELF

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.