Wednesday, January 15, 2014

How to Check whether a Number is Palindrome or not?


Ques:-How to Check whether a Number is Palindrome or not? Write a SQL Query?


Ans:- SELECT CASE WHEN REVERSE(:N)=:N THEN 'YES'
                                     ELSE 'NO'
                                     END RESULT
           FROM (
                          SELECT :N 
                           FROM DUAL
                         );

if i enter 121 then it give 'YES' and if i enter 122 then it give 'NO'.



No comments:

Post a Comment