简体   繁体   中英

Extract numbers from a string in Informix

There are strings in my table as follows:

select '1. name 1' from dual union all
select '2. name 2' from dual union all
select '11. name 3' from dual union all
select '12. name 4' from dual

I need to extract the first numbers:

1 2 11 12

IBM claims that Informix supports substring_index() . If so:

select substring_index(col, '.', 1)

This doesn't exactly get the first number . It returns the first part of the string before the '.' , which appears to be the same thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM