Text_value is column with string values. I need to look for ONLY ':' and separate the left from the right and convert to numeric so I can perform an easy calculation. If ':' does not exist I want nulls to return. I am creating a view in Oracle SQL Developer
Text_Value (Column)
124
7
55:20
73:00
106:24
This is my code:
to_number(REGEXP_SUBSTR(b.text_value,'[^:]*',1,1)) AS Num,
to_number(REGEXP_SUBSTR(B.text_value,'[^:]*$')) AS FRACTION2
These are my results:
I would expect text_values that didn't contain ":" to return as null. That is what I would like to see.