GeekInterview.com
Series: Subject: Topic:
Question: 5 of 291

Reverse a string in Oracle without using reverse

How do I reverse a dtring in Oracle without using PL/SQl and without using the reverse function??
Asked by: amit88 | Member Since Apr-2012 | Asked on: Apr 5th, 2012

View all questions by amit88

Showing Answers 1 - 1 of 1 Answers

Are you looking for something like this?

Code
  1. FUNCTION revstring(instring VARCHAR2) RETURN VARCHAR2 IS
  2.   rstring VARCHAR2(750) := ;
  3.   iCnt    PLS_INTEGER;
  4.   FOR icnt IN REVERSE 1..LENGTH(istring) LOOP
  5.     BEGIN
  6.       rstring := rstring ||  SUBSTR(istring, icnt, 1);
  7.     END;
  8.   END LOOP;
  9.   RETURN rstring;

Yes  1 User has rated as useful.
  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Question Categories

Oracle DBA FAQ

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.