Oracle Inversion inversion function

Source: Internet
Author: User

Oracle provides a inverted inverted function reverse, but this function cannot be grouped upside down, this article provides a function that can be grouped upside down, as follows:

CREATE OR REPLACE FUNCTION reverse_f (p_str VARCHAR2, P_delimiter varchar2:= ")  RETURN VARCHAR2 is  V_return VARCHAR2 (4000);  VP_STR   VARCHAR2 (4000): = P_STR;  V_IDX number    ;  Vp_len number   : = Length (P_delimiter); BEGIN  if (P_delimiter is null) then    Select Reverse (p_str) to V_return from dual;  else    loop      v_idx: = InStr (Vp_str, p_delimiter);      if (v_idx = 0) Then        v_return: = Vp_str | | v_return;        Exit;      elsif (v_idx = 1) then        v_return: = substr (Vp_str, 1, vp_len) | | V_return;        Vp_str   : = substr (Vp_str, Vp_len + 1);      else        V_return: = substr (Vp_str, 1, v_idx-1) | | V_return;        Vp_str   : = substr (Vp_str, v_idx);      End If;    End Loop;  End If;  RETURN V_return; END Reverse_f;

Oracle Inversion inversion function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.