Here you will get pl/sql program for palindrome number.
A number is called palindrome number if its reverse is equal to itself. For example 12321 is palindrome while 123 is not palindrome.
Pl/SQL Program for Palindrome Number
declare n number; m number; rev number:=0; r number; begin n:=12321; m:=n; while n>0 loop r:=mod(n,10); rev:=(rev*10)+r; n:=trunc(n/10); end loop; if m=rev then dbms_output.put_line('number is palindrome'); else dbms_output.put_line('number is not palindrome'); end if; end; /
Output
number is palindrome
Comment below if you have any queries regarding above palindrome program in pl sql.
DECLARE
X VARCHAR2(20) := ‘&TYPR_STRING’;
Y VARCHAR2(20);
BEGIN
SELECT 1 INTO Y FROM DUAL
WHERE X = REVERSE(X);
IF Y IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE(‘STRING IS PALINDROME’);
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE(‘STRING IS NOT PALINDROME’);
END;
try this 🙂 …..
Nice
trunc kya karta hai…..??????
i mean yaha pe q use kiya
How we can generate the palindrome numbers with in a limit in plsql
create a pl/sql program to update using various triggers