IMAGE_PATH(its column name) Such type of value in column given below
sph/images///////30_Fairhall_Court.jpeg
sph/images///8_Furnival_Court.jpeg
sph//images/9_Pennethorne_House.jpeg
rbkc/images/TAVISTOCK_CRESCENT.jpeg
haringey///images///399932thumb.jpg
urbanchoice//images//18190862.jpg
westminster/images//7_Glarus_Court.jpeg
我想更新所有列的行,其中有多个'/',如
sph/images/30_Fairhall_Court.jpeg
sph/images/8_Furnival_Court.jpeg
sph/images/9_Pennethorne_House.jpeg
rbkc/images/TAVISTOCK_CRESCENT.jpeg
haringey/images/399932thumb.jpg
urbanchoice/images/18190862.jpg
westminster/images/7_Glarus_Court.jpeg
请建议如何通过在单个'/'
中替换多个'/'来更新列答案 0 :(得分:3)
您可以使用regexp_replace。
select regexp_replace( 'sph/images///////30_Fairhall_Court.jpeg', '(/){2,}','\1' )
from dual
sph/images/30_Fairhall_Court.jpeg
因此,您的更新声明将如下所示:
update yourtable
set filename_column = regexp_replace( filename_column, '(/){2,}','\1' )
where instr(filename_column,'//')>0