Oracle Segmentation 9i

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:

Esta entrada ha sido publicada en DataBase, Oracle Data Base y etiquetada como , , . Guarda el enlace permanente.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.