Oracle provides a reverse inversion function, reverse, but this function cannot be used for grouping inversion. This article provides a function that can be used for grouping inversion, as shown below:
Oracle provides a reverse inversion function, reverse, but this function cannot be used for grouping inversion. This article provides a function that can be used for grouping inversion, as shown below:
Oracle provides a reverse inversion function reverse, but this function cannot be used for grouping inversion. This article provides a function that can be used for grouping inversion, as shown below:
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) into 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;
Detailed examples of Oracle function GREATEST Functions
Single-row conversion functions of Oracle Functions
Oracle functions that generate dynamic prefixes and auto-increment numbers
Replace () for Oracle Functions ()
Oracle Functions
Differences in case and decode usage and Performance Comparison of Oracle Functions