postgresql没有instr()函数,可以使用position(substring in string)函数定位字符串:
select position('om' in 'Thomas');
-- 返回结果3
因此使用substr()和position()函数,可以方便的截取字符串多个括号“()”内的子串:
例: 从“山东(曲阜市(郊区))”中截取括号内“曲阜市(郊区)”
select substr( '山东(曲阜市(郊区))',position( '(' in '山东(
postgresql没有instr()函数,可以使用position(substring in string)函数定位字符串:
select position('om' in 'Thomas');
-- 返回结果3
因此使用substr()和position()函数,可以方便的截取字符串多个括号“()”内的子串:
例: 从“山东(曲阜市(郊区))”中截取括号内“曲阜市(郊区)”
select substr( '山东(曲阜市(郊区))',position( '(' in '山东(