Oracle
RDBMS 오라클 유용한 팁모음
숫자에 comma 넣기
to_char(col,‘Fm999,999,999,990’)
SELECT NO
,REVERSE(TO_CHAR(no)) AS REVERSE_NO
,REGEXP_REPLACE(REVERSE(REGEXP_REPLACE( REVERSE(TO_CHAR(no)), '([0-9]{3})','\1,')), '^,','') AS COMMA_NO
FROM
(
SELECT 123456789 AS no
FROM dual
) V1
;
<<결과>>
NO REVERSE_NO COMMA_NO
--- ------------- -------------
123456789 987654321 123,456,789
숫자+문자 조합문자열에서 문자만 추출하는법
SELECT C
FROM (SELECT 'ABCDE' C FROM DUAL)
WHERE TRANSLATE(C, '0123456789', 'A') = C;
숫자로만 이루어진 문자열인지
SELECT C
FROM (SELECT '12345' C FROM DUAL)
WHERE TRANSLATE(C, '0123456789' || C, '0123456789') = C;
숫자+문자 조합문자열에서 숫자만 추출
SELECT TRANSLATE(C, '0123456789' || C , '0123456789')
FROM (SELECT '123ABC' C FROM DUAL) T;
mybatis mapper.xml 비교연산자 <=, >=, <, > 처리방법
문법 오류
where #{num} < 5
해결법
where #{num} <![CDATA[ < ]]> 5
comments powered by Disqus