plsql

Pages

  • Home
  • Web Development
  • c programming
  • java programming
  • minor projects
  • Python Programming

Thursday, 31 March 2016

write a pl/sql block to check a string for palindrome

DECLARE
    len number;
    palstr varchar2(20) := '&palstr';
    chkstr varchar2(20);

BEGIN
    len := length(palstr);
    for i in REVERSE 1..len loop
     chkstr := chkstr||substr(palstr,i,1);
    end loop;
    if chkstr = palstr then
     dbms_output.put_line(palstr||' is a PALINDROME');
    else
     dbms_output.put_line(palstr||' is not a PALINDROME');
    end if;
END; 
Posted by Varun wadhwa at 00:17
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Youtube Channel

Followers

Simple theme. Powered by Blogger.