Results 1 to 3 of 3

Thread: reverse a string

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Answers
    1

    reverse a string

    Can any one tell me hw to reverse a string without using the reverse function in sql

    Anoop


  2. #2
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: reverse a string

    Try this.............

    Select Replace (Replace (str, ',', Null), '', Null)
    From (Select Replace (XMLAGG (XMLELEMENT ("t", str)), '', ',') str
    From (Select SUBSTR ('welcome', ROWNUM, 1) str
    From user_objects
    Where ROWNUM <= Length (TRIM ('welcome'))
    Order By ROWNUM Desc))

    Sireesha

  3. #3

    Re: reverse a string

    Try this

    SELECT replace((SUBSTR (SYS_CONNECT_BY_PATH (x , ','), 2)),',','') csv
    FROM (SELECT substr('LAVANYA',-ROWNUM,1) AS x , ROW_NUMBER () OVER (ORDER BY ROWNUM ) rn,
    COUNT (substr('LAVANYA',-ROWNUM,1)) OVER () cnt
    FROM scott.emp)
    WHERE rn = cnt
    START WITH rn = 1
    CONNECT BY rn = PRIOR rn + 1;


  4.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact