Hi All,
Below is my table.
WITH t AS
(SELECT 1as sno,'first|second|thrid|forth|fifth|six' AS str FROM dual
UNION ALL
SELECT 2 AS sno, 'first|secondt|thrid' AS str FROM dual
UNION ALL
SELECT 3 AS sno, 'first' AS str FROM dual
UNION ALL
SELECT 4 AS sno,NULL AS str FROM dual
)
SELECT * FROM t;
---
Replace 'thrid' with '3rd' if the string present.
expected output:
1,'first|second|3rd|forth|fifth|six'
2,'first|second|3rd'
3,'first|3rd'
4,'||3rd'