PL/SQL Program to Reverse the given String

PL/SQL Program to Reverse the given String:

declare
str1 varchar2(30);
len number;
str2 varchar2(30);
i number;
begin
str1:=:str1;
len:=length(str1);
for i in reverse 1..len
loop
str2:=str2 || substr(str1,i,1);
end loop;
dbms_output.put_line('Given string is: '||str1);
dbms_output.put_line('Reverse string is: '||str2);
end;

OUTPUT:

Given string is: BaronTuts
Reverse string is: stuTnoraB

You may also like...

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.