Oracle intercepts a specific part of the string substr,instr

The oplog is cbob type, and the data may be as follows:
------Data 1-----
[Basic police information box]
Alarm number=20160---0017G0080
Alarm time=2016-03-14 02: 27:23
Alarm type = 110
Contact number = 1897------ 01
Identity and others = male
shift leader = Huang Ping's
original police nature = ask phone
sign building = -- province -- town; near 020 township road; Zhongzhou, Mazili , Yuanwu
[Police Information Features]
New Police Information Content = Caller Name: Newly Added Police Status
=
[Digital Recording]
Recording Number=2016031401100019D 02:27:23
Recording Number=2016031401100019D 02:28:07

------Data 2-----

[Basic police information box]
Police information number=2016---40001H0020
Alarm time=2016-03-14 00:01:12 Alarm
type=110
Contact number=1501---6228
Identity and others=male monitor
on duty=
[Police Emotional features]
Added police information = Caller name:
Added police situation =

----------------
Need to get the content part of the data that contains the landmark building

select oplog from jqcase t WHERE T.JQTIME>='2016-03-14 00:00:00'  and oplog like '%标志建筑=%'

select jqno,jqtime,oplog,substr(oplog,(instr(oplog,'sign building=')),((instr(oplog,'[warning feature]')-(instr(oplog,'sign building=') )))) from jqcase t
 WHERE T.JQTIME>='2016-03-14 00:00:00' --and oplog like '%sign building=%' and


select jqno,jqtime,oplog ,case when (instr(oplog,'sign building='))>0 then substr(oplog,(instr(oplog,'sign building=')),((instr(oplog,'[warning [Features]')-(instr(oplog,'sign building='))))) else '' end
 from jqcase t
 WHERE T.JQTIME>='2016-03-14 00:00:00' --and oplog like '%sign building=%'

----------final SQL-----------
select jqno,jqtime,oplog ,case when (instr(oplog,'sign building='))>0 then substr(oplog ,(instr(oplog,'sign building=')+5),((instr(oplog,'[warning feature]')-(instr(oplog,'sign building='))-5))) else ' ' end
 from jqcase t
 WHERE T.JQTIME>='2016-03-14 00:00:00' --and oplog like '%sign building=%'

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327043662&siteId=291194637