2

Please help me with this.

It is possible to split field values using a specific character? Here is my sample table

value
10uF
2K
1.0uF
200UF

I want it to split by this:

value       capacitance/resistance
 10            uF
 2             K
 1.0           uF
 200           UF

PS: I am using Oracle and the numbers should be separated from letters

0

1 Answer 1

2

Using regular expressions is an option:

create table capacity (inputdata varchar2(30));

insert into capacity(inputdata) values('10uF');
insert into capacity(inputdata) values('2K');
insert into capacity(inputdata) values('1.0uF');
insert into capacity(inputdata) values('200UF');

commit;

select regexp_substr(inputdata,'^[0123456789.]*') value,
regexp_replace(inputdata,'^[0123456789.]*','') unit
from capacity
;

here is this example on sqlfiddle Maybe you should improve the regular expression pattern of the number format

Regular expression functions are described here in the manual and on the following pages

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.