안녕하세요. 문자 추출을 하려고 하는데요.
아래와 같이 change_after 처럼 나오게 하고 싶은데 REPLACE(REPLACE(REGEXP_SUBSTR(T, '[0-9]+pdf'), 'pdf'), '_','') 이런 방식으로는
추출이 안되는데. 추출 방법 좀 알려주시면 감사하겠습니다~
change_before | change_after |
5294710_A_2017 결과.pdf | 5294710_2017.pdf |
5269877_B_2017 결과.pdf | 5269877_2017.pdf |
76431_C_2017 결과.pdf | 76431_2017.pdf |
WITH T (change_before,change_after) AS ( SELECT '5294710_A_2017 결과.pdf' , '5294710_2017.pdf' FROM DUAL UNION ALL SELECT '5269877_B_2017 결과.pdf' , '5269877_2017.pdf' FROM DUAL UNION ALL SELECT '76431_C_2017 결과.pdf' , '76431_2017.pdf' FROM DUAL ) SELECT change_before , change_after , REPLACE(REGEXP_REPLACE(change_before,'[^0-9|_|.pdf]+','') ,'__','_') change_after2 FROM T