Check whether a string is palindrome or not in PL/SQL Last Updated : 12 Jul, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report Prerequisite - PL/SQL introduction In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations. Given a string and the task is to find whether it is Palindrome or not. Examples: Input: str = geeksskeeg Output: geeksskeeg is palindrome Input: str = geeks Output: geeks is not palindrome Approach is to take the string, reverse it and check whether the reversed string is equal to the original string or not. If it is equal, then it will be palindrome otherwise not. Below is the required implementation: SQL DECLARE -- Declared variables are s, l, t . -- These variables are of same data type VARCHAR. s VARCHAR2(10) := 'abccba'; l VARCHAR2(20); t VARCHAR2(10); BEGIN FOR i IN REVERSE 1..Length(s) LOOP l := Substr(s, i, 1); -- here || are used for concatenation of string. t := t ||'' ||l; END LOOP; IF t = s THEN dbms_output.Put_line(t ||'' ||' is palindrome'); ELSE dbms_output.Put_line(t ||'' ||' is not palindrome'); END IF; END; -- Program End Output: abccba is palindrome Comment More infoAdvertise with us Next Article Check whether a string is palindrome or not in PL/SQL S Shashank12 Follow Improve Article Tags : Misc SQL SQL-PL/SQL Practice Tags : Misc Similar Reads Check if a number is Palindrome in PL/SQL Given an integer, write a function that returns true if the given number is palindrome, else false. For example, 12321 is palindrome, but 1451 is not palindrome. Let the given number be num. A simple method for this problem is to first reverse digits of num, then compare the reverse of num with num. 1 min read To check a number is palindrome or not without using any extra space Given a number 'n' and our goal is to find out it is palindrome or not without using any extra space. We can't make a new copy of the number . Examples: Input : 2332 Output : Yes it is Palindrome. Explanation: original number = 2332 reversed number = 2332 Both are same hence the number is palindrome 6 min read Check whether a number is Emirpimes or not Given a number 'n', check whether it is an emirpimes or not. An emirpimes("semiprime" when spelled backwards) derives its definition from the way it is spelt. So, an emirpimes is a number that is a semiprime (product of two prime numbers) itself, and the reversal of its digits gives another new numb 10 min read Check if the characters in a string form a Palindrome in O(1) extra space Given string str. The string may contain lower-case letters, special characters, digits, or even white spaces. The task is to check whether only the letters present in the string are forming a Palindromic combination or not without using any extra space. Note: It is not allowed to use extra space to 10 min read Print the longest palindromic prefix of a given string Given a string str, the task is to find the longest palindromic prefix of the given string. Examples: Input: str = "abaac" Output: aba Explanation: The longest prefix of the given string which is palindromic is "aba". Input: str = "abacabaxyz" Output: abacaba Explanation: The prefixes of the given s 12 min read Like