PL/SQL Program to Swap Two Strings

PL/SQL Program to Swap Two Strings:

declare 
a varchar2(10); 
b varchar2(10);
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 Baron
Value of b is Tuts
 
After Swapping: 
Value of a is Tuts
Value of b is Baron

Leave a Reply

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

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