0

我正在存储这样的日志:

10.03.2015 11:45:29-JAQ -- Updated Following Information
Mobile Updated From 0 to 0502770020</br>
Company Industry Id Updated From 747 to 753</br>
Name Updated from futurehomes to futurehomesdubai </br>
Company Head Office Updated From 0 to 1</br>
Company Telephone Updated From 8008436699 to
Company Comments Updated From Offices and Hotel (Under Construction) to  Offices and Hotel (Under Construction) info@futurehomesdubai.com futurehomesdubai.com</br>
Company Toll Free No Updated From to 800-8436699</br>
Company(139618) Industry Sub Section Updated </br>

我将其存储在文本字段中。从这里我只需要显示从 futurehomes 到 futurehomesdubai 部分的更新名称。futurehomes 到 futurehomesdubai 将根据公司名称而变化。我怎样才能做到这一点?

4

1 回答 1

0

以以下为例:

create table logs(tlog text);

insert into logs values ('Mobile Updated From 0 to 0502770020</br>Company Industry Id Updated From 747 to 753</br>Name Updated from futurehomes to futurehomesdubai </br>Company Head Office Updated From 0 to 1</br>Company Telephone Updated From 8008436699 to
Company Comments Updated From Offices and Hotel (Under Construction) to  Offices and Hotel (Under Construction)info@futurehomesdubai.com futurehomesdubai.com</br>Company Toll Free No Updated From to 800-8436699</br>Company(139618) Industry Sub Section Updated </br>');

并且选择应该是

select * 
from (
     select unnest(regexp_split_to_array(tlog,'</br>')) col 
     from logs
     )t
where col ilike 'Name Updated%'

结果:

col                                                
-------------------------------------------------- 
Name Updated from futurehomes to futurehomesdubai
于 2015-10-13T05:28:41.007 回答