Q. Write a PL/SQL block to check whether string is palindrome or not.
Answer:
Palindrome string: It is a word or sequence of letters which can be read same as forward and backward.
For example:
MADAM
The following PL/SQL code will check weather the String is palindrome or not.
Output:

Answer:
Palindrome string: It is a word or sequence of letters which can be read same as forward and backward.
For example:
MADAM
The following PL/SQL code will check weather the String is palindrome or not.
DECLARE str varchar2(50):='&string';
counter int:=length(str);
BEGIN dbms_output.put_line(counter);
LOOP exit WHEN counter=0;
exit WHEN not(substr(str,counter,1)=substr(str,((length(str)+1)-counter),1));
counter:=counter-1;
END LOOP;
IF counter=0 THEN dbms_output.put_line(str||'is palindrom');
ELSE dbms_output.put_line(str||'is not palindrom');
END IF;
END;
/
Output:



