Advertisement
Shailrshah

A Procedure to Print a String in Reverse

Oct 27th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.33 KB | None | 0 0
  1. CREATE OR REPLACE PROCEDURE ReverseOf(input IN VARCHAR2) IS
  2.         REVERSE VARCHAR2(50);
  3. BEGIN
  4.         FOR i IN REVERSE 1..LENGTH(input) LOOP
  5.                 REVERSE := REVERSE||''||SUBSTR(input, i, 1);
  6.         END LOOP;
  7.         DBMS_OUTPUT.put_line('The reverse of '||input||' is '||REVERSE||'.');
  8. END;
  9. /
  10. EXEC ReverseOf('TSEC');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement