WAP to print the sum of number using procedure.
create or replace
procedure addition(a int, b int, c out int)
is
begin
c:=a+b;
end;
declare
s int;
begin
addition(23,29,s);
dbms_output.put_line('output'||s);
end;
Results
output52
PL/SQL procedure successfully completed.
procedure addition(a int, b int, c out int)
is
begin
c:=a+b;
end;
declare
s int;
begin
addition(20,30,s);
dbms_output.put_line('output'||s);
addition(50,90,s);
dbms_output.put_line('output'||s);
addition(59,99,s);
dbms_output.put_line('output'||s);
end;
Results
output50
output140
output158
PL/SQL procedure successfully completed.
WAP to print the Even or Odd number using procedure.
create or replace procedure evenodd(x int,y out int)
is
begin
if x mod 2=0 then
dbms_output.put_line('Number is even');
else
dbms_output.put_line('Number is odd');
end if;
end;
set serveroutput on
declare
n int;
a int;
begin
n:=&n;
evenodd(n,a);
end;
Results
old 5: n:=&n;
new 5: n:=3;
Number is odd
PL/SQL procedure successfully completed.
Write a program to print the simple interest by using procedure ?
Create or Replace
procedure simpleintrest(p int, t int, r int, SI out int)
is
begin
SI:=p*t*r/100;
end;
set serveroutput on
declare
SI int;
begin
simpleintrest(2000, 2, 10, SI);
dbms_output.put_line('Output SI !'||SI);
end;
Results
Output SI !400
PL/SQL procedure successfully completed
Write a program to print the Compound interest by using procedure ?
Create or Replace
procedure compoundintrest(p int, n int, r int, CI out int)
is
begin
CI:=p*(1+r/100)**n;
end;
set serveroutput on
declare
CI int;
begin
compoundintrest(2000, 2, 10, CI);
dbms_output.put_line('Output CI !'||CI);
end;
Results
Output CI !2420
PL/SQL procedure successfully completed.
create or replace
procedure addition(a int, b int, c out int)
is
begin
c:=a+b;
end;
declare
s int;
begin
addition(23,29,s);
dbms_output.put_line('output'||s);
end;
Results
output52
PL/SQL procedure successfully completed.
OR
create or replaceprocedure addition(a int, b int, c out int)
is
begin
c:=a+b;
end;
declare
s int;
begin
addition(20,30,s);
dbms_output.put_line('output'||s);
addition(50,90,s);
dbms_output.put_line('output'||s);
addition(59,99,s);
dbms_output.put_line('output'||s);
end;
Results
output50
output140
output158
PL/SQL procedure successfully completed.
WAP to print the Even or Odd number using procedure.
create or replace procedure evenodd(x int,y out int)
is
begin
if x mod 2=0 then
dbms_output.put_line('Number is even');
else
dbms_output.put_line('Number is odd');
end if;
end;
set serveroutput on
declare
n int;
a int;
begin
n:=&n;
evenodd(n,a);
end;
Results
old 5: n:=&n;
new 5: n:=3;
Number is odd
PL/SQL procedure successfully completed.
Write a program to print the simple interest by using procedure ?
Create or Replace
procedure simpleintrest(p int, t int, r int, SI out int)
is
begin
SI:=p*t*r/100;
end;
set serveroutput on
declare
SI int;
begin
simpleintrest(2000, 2, 10, SI);
dbms_output.put_line('Output SI !'||SI);
end;
Results
Output SI !400
PL/SQL procedure successfully completed
Write a program to print the Compound interest by using procedure ?
Create or Replace
procedure compoundintrest(p int, n int, r int, CI out int)
is
begin
CI:=p*(1+r/100)**n;
end;
set serveroutput on
declare
CI int;
begin
compoundintrest(2000, 2, 10, CI);
dbms_output.put_line('Output CI !'||CI);
end;
Results
Output CI !2420
PL/SQL procedure successfully completed.
No comments:
Post a Comment