Oracle9i 9.2.0.6.0 – 64bit Production
Execute this query
WITH T AS (
SELECT ‘/20/’ TXT FROM DUAL
UNION
SELECT ‘/20/21/’ TXT FROM DUAL
UNION
SELECT ‘/20/22/’ TXT FROM DUAL
UNION
SELECT ‘/20/23/24/’ TXT FROM DUAL
UNION
SELECT ‘/20/23/25/’ TXT FROM DUAL
) SELECT * from T
select replace(SUBSTR(txt,length(A.txt)-3, length(A.txt)),’/’,») SEGMENTATION
FROM (WITH T AS (
SELECT ‘/20/’ TXT FROM DUAL
UNION
SELECT ‘/20/21/’ TXT FROM DUAL
UNION
SELECT ‘/20/22/’ TXT FROM DUAL
UNION
SELECT ‘/20/23/24/’ TXT FROM DUAL
UNION
SELECT ‘/20/23/25/’ TXT FROM DUAL
) SELECT * from T) A
Result:
Or
— DDL for Table SEGMENTATION
CREATE TABLE «SEGMENTATION»
( «TXT» VARCHAR2(10 BYTE)
) ;
Insert into SEGMENTATION (TXT) values (‘/20/’);
Insert into SEGMENTATION (TXT) values (‘/20/21/’);
Insert into SEGMENTATION (TXT) values (‘/20/22/’);
Insert into SEGMENTATION (TXT) values (‘/20/23/24/’);
Insert into SEGMENTATION (TXT) values (‘/20/23/25/’);
select replace(SUBSTR(TXT,length(TXT)-3, length(TXT)),’/’,») SEGMENTATION
from SEGMENTATION
Result: