Wednesday, October 25, 2017

Oracle 11g - REGEXP_SUBSTR extract comma delimiter string to fields

select REGEXP_SUBSTR('CHIDAM,,20-Feb-17,1-Feb-19', '([^,]*)(,|$)', 1, 1,NULL,1) f1,
REGEXP_SUBSTR('CHIDAM,,20-Feb-17,1-Feb-19', '([^,]*)(,|$)', 1, 2,NULL,1) f2,
REGEXP_SUBSTR('CHIDAM,,20-Feb-17,1-Feb-19', '([^,]*)(,|$)', 1, 3,NULL,1) f3,
REGEXP_SUBSTR('CHIDAM,,20-Feb-17,1-Feb-19', '([^,]*)(,|$)', 1, 4,NULL,1) f4

from dual

Output

F1
F2
F3
F4
CHIDAM

20-Feb-17
1-Feb-19

No comments:

Post a Comment

Oracle Standard Package for Order Totals

  Purpose: Sometimes we need to show line-wise or complete order totals (Basic / Tax / Tax+Basic) in reports. Oracle provides a standard...