Skip to content
Related Articles

Related Articles

Check if a number is Palindrome in PL/SQL

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 16 May, 2018
Improve Article
Save Article

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. If both are same, then return true, else false.


Input : 12221
Output : true

Input : 12345
Output : false

Below is the required implementation:

-- declare variable n, m, temp 
-- and temp of datatype number
    n number;
    m number;
    temp number:=0;
    rem number;
    -- while loop with condition till n>0
    while n>0
    end loop; -- end of while loop here
    if m = temp
    end if;
-- Program End


My Personal Notes arrow_drop_up

Start Your Coding Journey Now!