我正在尝试找到最接近 substr 的分隔符,并且对字符数有限制。
Eg: select 'oneone,twotwo, threethree, four,five,six,seven,eight,nine,ten,eleven,twelve' from dual;
现在,我想限制 substr 仅从该字符串中提取前 30 个字符,同时确保 substr 以最近的 "," 结尾,如果它无法在 30 个字符中找到终点。
select substr('oneone,twotwo, threethree, four,five,six,seven,eight,nine,ten,eleven,twelve',1,30) from dual ;-- First 30 characters.
前 30 个字符产生:oneone,twotwo,threethree,fou 但是,我希望预期的结果是在“fou”的不完整输入之前找到最近的分隔符“,”并得到结果。
Expected Result:oneone,twotwo, threethree -- since "fou" is incomplete and thus should be excluded