I have an alarm string that is sometimes comma delimited - some examples are: '1', '1, 2', '1, 2, 3, 4, 5, 6' (There could be one alarm, and up to six alarms, spaced as shown in the example).
I can hard code the substr code like:
v_name := '1, 2, 3, 4, 5, 6';
SELECT substr( v_name,1, 1 ) alarm1,
substr( v_name,4, 1 ) alarm2,
substr( v_name,7, 1 ) alarm3,
substr( v_name,10, 1 ) alarm4,
substr( v_name,13, 1 ) alarm5,
substr( v_name,16, 1 ) alarm6
INTO v_First, v_Second, v_Third,v_Fourth,v_Fifth,v_Sixth
from dual;
But my spidey senses are on high, since the engineers swear that the alarms cannot be transmitted in any other way. I would like to find a way to parse the alarms based on comma position.
Any help would be greatly appreciated!
Thank you.
T.j.
Oracle LazyDBA home page