简体   繁体   中英

Json array Count in Oracle sql

I'm having below value in the column "c1" (which is of datatype clob) on table "t1" in oracle (version 19c )

Data

[{"ID":"1","DUPID":"1"},{"ID":"2","DUPID":"2"},{"ID":"3","DUPID":"3"},{"ID":"4","DUPID":"4"},{"ID":"5","DUPID":"5"},{"ID":"6","DUPID":"6"},{"ID":"7","DUPID":"7"}]

I would like to get the count of the array. I've queried like below. But would like to know if there is a better way to achieve this.

Query used:

select regexp_count ( c1,'},{' ) +1 from t1 ;
select 
    JSON_value('[0,1,2,3,4]', '$.size()')
from dual ;

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