사용자 도구

사이트 도구


dbms:oracle:devel:regexp:regexp_substr

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
dbms:oracle:devel:regexp:regexp_substr [2018/05/09 02:44]
starlits [뒷자리 4자리만 가져오기]
dbms:oracle:devel:regexp:regexp_substr [2019/03/05 00:40]
starlits [구분자로 나누기]
줄 125: 줄 125:
 --- - ----- --- - -----
 147 1 36126 147 1 36126
 +</code>
 +
 +  - 공백으로 나눈다 <code sql>
 +with v_time as (
 +    select '2016. 1. 29. 오후 11:00:53' as time from dual
 +)
 +select 
 +    time
 +    ,REGEXP_SUBSTR(time,'[^ ]+',1,1,'i'
 +    || REGEXP_SUBSTR(time,'[^ ]+',1,2,'i'
 +    || REGEXP_SUBSTR(time,'[^ ]+',1,3,'i') AS ymd
 +    ,TO_DATE(REGEXP_SUBSTR(time,'[^ ]+',1,1,'i'
 +    || REGEXP_SUBSTR(time,'[^ ]+',1,2,'i'
 +    || REGEXP_SUBSTR(time,'[^ ]+',1,3,'i'),'YYYY.fmMM.DD.') AS convert_time   
 +from v_time;
 +</code>
 +  - 결과값 <code>
 +TIME                       YMD              CONVERT_TIME       
 +------------------------   ---------------  -------------------
 +2016. 1. 29. 오후 11:00:53  2016.1.29.       2016-01-29 00:00:00
 </code> </code>
  
줄 157: 줄 177:
   - 숫자/문자로만 이루어진 첫단어 <code sql>   - 숫자/문자로만 이루어진 첫단어 <code sql>
 SELECT REGEXP_SUBSTR('first-team second-team third-team', '[[:alnum:]]*') FROM dual; SELECT REGEXP_SUBSTR('first-team second-team third-team', '[[:alnum:]]*') FROM dual;
-</code>+</code> <code>first</code>
   - 스페이스가 있기 전까지의 첫단어 <code sql>   - 스페이스가 있기 전까지의 첫단어 <code sql>
 SELECT REGEXP_SUBSTR('first-team second-team third-team', '[^ ]+') FROM dual; SELECT REGEXP_SUBSTR('first-team second-team third-team', '[^ ]+') FROM dual;
-</code>+</code><code>first-team</code>
dbms/oracle/devel/regexp/regexp_substr.txt · 마지막으로 수정됨: 2019/03/05 00:40 저자 starlits