我在CLOB
列中有以下数据,我希望从以下数据中获取xyz.com
。 DOMAIN NAME LIST
不会改变,并且会一直相同
{
"OBJECT ID":"71864756",
"OBJECT NAME":"MESSENGER",
"PARENT ID":"71865529",
"OBJECT STATUS":"O",
"WHITE LISTED":"N",
"LAST UPLOAD":"",
"PARENT CLASS":"ORDER",
"IS A LINK OBJECT IND":"N",
"AOL IM FEDERATION":"false",
"ATTRIBUTE 1":"0",
"ATTRIBUTE 2":"0",
"ATTRIBUTE 3":"0",
"ATTRIBUTE 4":"0",
"ATTRIBUTE 5":"0",
"CLASSIC CENTER INTEGRATION URL":"",
"COMMENTS":"",
"DISPLAY NAME":"",
"DOMAIN NAME LIST":"xyz.com",
"ICON NAME":"SERVICE_16.PNG",
"IM LICENSES":"500",
}
请使用dbms_lob.substr
.....
答案 0 :(得分:2)
Oracle 11g R2架构设置:
CREATE TABLE table_name ( json CLOB )
/
INSERT INTO table_name VALUES (
'{"OBJECT ID":"71864756","OBJECT NAME":"MESSENGER","PARENT ID":"71865529","OBJECT STATUS":"O","WHITE LISTED":"N","LAST UPLOAD":"","PARENT CLASS":"ORDER","IS A LINK OBJECT IND":"N","AOL IM FEDERATION":"false","ATTRIBUTE 1":"0","ATTRIBUTE 2":"0","ATTRIBUTE 3":"0","ATTRIBUTE 4":"0","ATTRIBUTE 5":"0","CLASSIC CENTER INTEGRATION URL":"","COMMENTS":"","DISPLAY NAME":"","DOMAIN NAME LIST":"xyz.com","ICON NAME":"SERVICE_16.PNG","IM LICENSES":"500"}'
)
/
查询1 :
SELECT REGEXP_SUBSTR(
json,
'[{,]"DOMAIN NAME LIST":"((\\.|[^"])*)"',
1,
1,
NULL,
1
) AS domain_name_list
FROM table_name
<强> Results 强>:
| DOMAIN_NAME_LIST |
|------------------|
| xyz.com |