PL/SQL Program to Swap Two Number Without Using Third Variable

PL/SQL Program to Swap Two Number Without Using Third Variable:



declare 
a number; 
b number;
begin 
a:=:a;
b:=:b;
dbms_output.put_line('Value of a is '||a); 
dbms_output.put_line('Value of b is '||b); 
a:=a||b; 
b:=replace(a,b); 
a:=replace(a,b); 
dbms_output.put_line(' '); 
dbms_output.put_line('After Swapping: '); 
dbms_output.put_line('Value of a is '||a); 
dbms_output.put_line('Value of b is '||b); 
end;

OUTPUT:

Value of a is 13
Value of b is 5
 
After Swapping: 
Value of a is 5
Value of b is 13




Leave a Reply

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

eight − 8 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.