<< ์ซ์ํจ์ >>
- ABS(n) : ์ฃผ์ด์ง ๊ฐ์ ์ ๋๊ฐ ๋ฆฌํด
SELECT ABS(-10), ABS(10), ABS(0) FROM DUAL;
- CELL(n) : ์ฃผ์ด์ง ๊ฐ๋ณด๋ค๋ ํฌ์ง๋ง ๊ฐ์ฅ ๊ทผ์ ํ๋ ์ต์๊ฐ ๋ฆฌํด
SELECT CEIL(5.5) FROM DUAL;
- EXP(n) : ์ฃผ์ด์ง ๊ฐ์ e์ ์น์๋ฅผ ๋ฆฌํด (e = 2.171828183...)
SELECT EXP(5) FROM DUAL;
- FLOOP(n) : ์ฃผ์ด์ง ๊ฐ๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ ์ต๋ ์ ์๊ฐ์ ๋ฆฌํด
SELECT FLOOR(5.5) FROM DUAL;
- LN(n) : ์ฃผ์ด์ง ๊ฐ์ ์์ฐ๋ก๊ทธ ๊ฐ์ ๋ฆฌํด
SELECT LN(148.413) FROM DUAL;
- LOG(m, n) : ๋ฐ์ m์ผ๋ก ํ n์ ๋ก๊ทธ ๊ฐ์ ๋ฆฌํด
SELECT LOG(10, 1000) FROM DUAL;
- MOD(m, n) : m์ n์ผ๋ก ๋๋ ๋จ์ ๊ฐ์ ๋ฆฌํด. n์ด 0์ผ ๊ฒฝ์ฐ m์ ๋ฆฌํด
SELECT MOD(18, 5) FROM DUAL;
- POWER(m, n) : m์ n์น ๊ฐ์ ๋ฆฌํด
SELECT POWER(5, 2) FROM DUAL;
- ROUND(n, [m]) : n๊ฐ์ ๋ฐ์ฌ๋ฆผ์ ํ๋ ํจ์. m์ ๋ฐ์ฌ๋ฆผ ํ ์์์ ์๋ฆฌ ์๋ฅผ ๋ํ๋.
SELECT ROUND(3.545, 2) ROUND1
, TO_CHAR( ROUND( TO_DATE( '20230601 113131', 'YYYYMMDD HH24MISS' ), 'YYYY' ), 'YYYYMMDD HH24MISS' ) YYYY1
, TO_CHAR( ROUND( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'YYYY' ), 'YYYYMMDD HH24MISS' ) YYYY2
, TO_CHAR( ROUND( TO_DATE( '20230715 113131', 'YYYYMMDD HH24MISS' ), 'MM' ), 'YYYYMMDD HH24MISS' ) MM1
, TO_CHAR( ROUND( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'MM' ), 'YYYYMMDD HH24MISS' ) MM2
, TO_CHAR( ROUND( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'DD' ), 'YYYYMMDD HH24MISS' ) DD1
, TO_CHAR( ROUND( TO_DATE( '20230716 123131', 'YYYYMMDD HH24MISS' ), 'DD' ), 'YYYYMMDD HH24MISS' ) DD2
, TO_CHAR( ROUND( TO_DATE( '20231231 112931', 'YYYYMMDD HH24MISS' ), 'HH24' ), 'YYYYMMDD HH24MISS' ) HH1
, TO_CHAR( ROUND( TO_DATE( '20231231 113031', 'YYYYMMDD HH24MISS' ), 'HH24' ), 'YYYYMMDD HH24MISS' ) HH2
, TO_CHAR( ROUND( TO_DATE( '20231231 113129', 'YYYYMMDD HH24MISS' ), 'MI' ), 'YYYYMMDD HH24MISS' ) MI1
, TO_CHAR( ROUND( TO_DATE( '20231231 113131', 'YYYYMMDD HH24MISS' ), 'MI' ), 'YYYYMMDD HH24MISS' ) MI2
FROM DUAL;
- SIGN(n) : n<0์ผ ๊ฒฝ์ฐ, -1์ ๋ฆฌํด, n=0์ผ ๊ฒฝ์ฐ 0์ ๋ฆฌํด, N>0์ผ ๊ฒฝ์ฐ 1์ ๋ฆฌํด
SELECT SIGN(5) C1, SIGN(-5) C2, SIGN(0) C3 FROM DUAL;
- SQRT(n) : ์ฃผ์ด์ง ๊ฐ์ ๋ฃจํธ๊ฐ์ ๋ฆฌํด. ์ด๋ n์ ์์์ฌ์ผํจ.
SELECT SQRT(26) FROM DUAL;
- TRUNC(n, m) : n๊ฐ์ ์์์ m๋ฒ์งธ ์๋ฆฌ๋ก ๋ฐ๋ด๋ฆผํ ๊ฐ์ ๋ฆฌํด
SELECT TRUNC(3.545, 2)
, TO_CHAR( TRUNC( TO_DATE( '20230601 113131', 'YYYYMMDD HH24MISS' ), 'YYYY' ), 'YYYYMMDD HH24MISS' ) YYYY
, TO_CHAR( TRUNC( TO_DATE( '20230715 113131', 'YYYYMMDD HH24MISS' ), 'MM' ), 'YYYYMMDD HH24MISS' ) MM
, TO_CHAR( TRUNC( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'DD' ), 'YYYYMMDD HH24MISS' ) DD
, TO_CHAR( TRUNC( TO_DATE( '20231231 112931', 'YYYYMMDD HH24MISS' ), 'HH24' ), 'YYYYMMDD HH24MISS' ) HH
, TO_CHAR( TRUNC( TO_DATE( '20231231 113129', 'YYYYMMDD HH24MISS' ), 'MI' ), 'YYYYMMDD HH24MISS' ) MI
, TO_CHAR( TRUNC( TO_DATE( '20231231 113129', 'YYYYMMDD HH24MISS' ), 'DD' ), 'YYYYMMDD HH24MISS' ) DD
FROM DUAL;
- REGEXP_COUNT( source_char, pattern{, replace_string{, position{, occurrence{, match_parameter}}}} )
- ๋ฌธ์์ด์์ ์ง์ ํ ํจํด ์กฐ๊ฑด(์ ๊ทํํ์, ์ ๊ท์)์ ๋ง์กฑํ๋ ๋ถ๋ถ์ ๊ฒ์ํด ๋ค๋ฅธ ๋ฌธ์์ด๋ก ์นํ
- ๋ณต์ํฉ ์นํ/๊ฒ์ ์กฐ์์ ๊ฐ๋ฅํ๊ฒ
SELECT REGEXP_COUNT( 'abcabcabc', 'abc', 1 ) A
, REGEXP_COUNT( 'abcabcabc', 'abc', 4 ) B
, REGEXP_COUNT( 'abcabcabc', 'abc', 7 ) C
, REGEXP_COUNT( 'abcabcabc', 'abc', 10 ) D
FROM DUAL;
- GREATEST(n1, n2, n3, ...) : ์ฃผ์ด์ง ๊ฐ ์ค์์ ๊ฐ์ฅ ํฐ ๊ฐ์ ๋ฆฌํด
SELECT GREATEST( 9, 10, 8, 2 ) COL1 FROM DUAL;
- LEAST(n1, n2, n3, ...) : ์ฃผ์ด์ง ๊ฐ ์ค์์ ๊ฐ์ฅ ์์ ๊ฐ์ ๋ฐํ
SELECT LEAST( 9, 10, 8, 2 ) COL1 FROM DUAL;
<< ๋ฌธ์์ด ์ฒ๋ฆฌํจ์ >>
- CONCAT(char1, char2) : Concatenation์ ์ฝ์๋ก, ๋ ๋ฌธ์๋ฅผ ๊ฒฐํฉํ๋ ์ญํ . "||" ์ฐ์ฐ์์ ๊ฐ์ ์ญํ
SELECT CONCAT('Oracle', ' Korea') NAME FROM dual;
- INITCAP(char) : ์ฃผ์ด์ง ๋ฌธ์์ด์ ์ฒซ ๋ฒ์งธ ๋ฌธ์๋ฅผ ๋๋ฌธ์๋ก ๋ณํ
SELECT INITCAP('HEllo WOrld!') FROM dual;
- LOWER(char) : ๋ฌธ์์ด์ ์๋ฌธ์๋ก ๋ณํ
SELECT LOWER('HEllo WOrld!') FROM dual;
- UPPER(char) : ๋ฌธ์์ด์ ๋๋ฌธ์๋ก ๋ณํ
SELECT UPPER('HEllo WOrld!') FROM dual;
- LPAD(char1, n [,char2]) :์ผ์ชฝ์ ๋ฌธ์์ด์ ๋ผ์ด ๋๋ ์ญํ
- n์ ๋ฐํ๋๋ ๋ฌธ์์ด์ ์ ์ฒด ๊ธธ์ด๋ฅผ ๋ํ๋ด๋ฉฐ, char1์ ๋ฌธ์์ด์ด n๋ณด๋ค ํด ๊ฒฝ์ฐ char2์ n๊ฐ ๋ฌธ์์ด ๋งํผ ๋ฆฌํด
SELECT LPAD('JUNG-SICK', 11, '*') NAME FROM dual;
- RPAD(char1, n [,char2]) : ์ค๋ฅธ์ชฝ์ ๋ฌธ์์ด์ ๋ผ์ด ๋๋ ์ญํ
- n์ ๋ฐํ๋๋ ๋ฌธ์์ด์ ์ ์ฒด ๊ธธ์ด๋ฅผ ๋ํ๋ด๋ฉฐ, char1์ ๋ฌธ์์ด์ด n๋ณด๋ค ํด ๊ฒฝ์ฐ char2์ n๊ฐ ๋ฌธ์์ด ๋งํผ ๋ฆฌํด
SELECT RPAD('JUNG-SICK', 11, '*') NAME FROM dual;
- SUBSTR(char, m ,[n]) : SUBSTRํจ์๋ฅผ ์ด์ฉํ์ฌ m ๋ฒ์งธ ์๋ฆฌ๋ถํฐ ๊ธธ์ด๊ฐ n๊ฐ์ธ ๋ฌธ์์ด์ ๋ฆฌํด
- m์ด ์์์ผ ๊ฒฝ์ฐ, ๋ค์์ m๋ฒ์งธ ๋ฌธ์๋ถํฐ ๋ฐ๋ ๋ฐฉํฅ์ผ๋ก n๊ฐ์ ๋ฌธ์๋ฅผ ๋ฆฌํด
SELECT SUBSTR('JUNG-SICK', 3, 3) COL1, SUBSTR('JUNG-SICK', -3, 3) COL2 FROM dual;
- LENGTH(char1) : ๋ฌธ์์ด์ ๊ธธ์ด๋ฅผ ๋ฆฌํด
SELECT LENGTH('JUNG-SICK') TEST FROM dual;
- REPLACE(char1, str1, str2) : ๋ฌธ์์ด์ ํน์ ๋ฌธ์๋ฅผ ๋ค๋ฅธ ๋ฌธ์๋ก ๋ณํ (๋์๋ฌธ์ ๊ตฌ๋ถ)
SELECT REPLACE('JACK and JUE','J','BL') COL1, REPLACE('JACK and JUE','j','BL') COL2 FROM dual;
- INSTR( char1, str1, position, seq ) : ๋ฌธ์(char1)์ ๋ฌธ์์ด(str1)์ด ํฌํจ๋์ด ์๋์ง๋ฅผ ์ข/์ฐ(position)๊ธฐ์ค์ผ๋ก ์กฐ์ฌํ์ฌ ๋ฌธ์์ด์ n๋ฒ์งธ ์์น(seq)๋ฅผ ๋ฆฌํด
- ์ง์ ํ ๋ฌธ์์ด์ด ๋ฐ๊ฒฌ๋์ง ์์ผ๋ฉด 0์ ๋ฆฌํด
SELECT INSTR('CORPORATE FLOOR','OK') COL1, INSTR('CORPORATE FLOOR','OR',3) COL2 FROM dual;
- TRIM : ํน์ ํ ๋ฌธ์๋ฅผ ์ ๊ฑฐ. ์ ๊ฑฐํ ๋ฌธ์๋ฅผ ์ ๋ ฅํ์ง ์์ผ๋ฉด ๊ธฐ๋ณธ์ ์ผ๋ก ๊ณต๋ฐฑ ์ ๊ฑฐ
- ๋ฆฌํด๊ฐ์ ๋ฐ์ดํฐํ์ ์ VARCHAR2
SELECT TRIM(' ABC DEC ') COL1, TRIM(0 FROM 0009872348900) COL2 FROM dual;
<< ๋ ์ง ์ฒ๋ฆฌํจ์ >>
- LAST_DAY(d) : ๋ฌ์ ๋ง์ง๋ง ๋ ์ ๋ ์ง๋ฅผ ๋ฆฌํด
SELECT SYSDATE COL1, LAST_DAY(SYSDATE) COL2 FROM dual;
- ADD_MONTHS(a, b) : a์ ๋ ์ง์ b์ ๋ฌ์ ๋ํ ๊ฐ์ ๋ฆฌํด
SELECT ADD_MONTHS(SYSDATE,3) COL1 FROM dual;
- MONTH_BETWEEN(a1, a2) : MONTH_BETWEEN์ a1๊ณผ a2 ์ฌ์ด์ ๋ฌ์ ์๋ฅผ NUMBERํ ํ์ ์ผ๋ก ๋ฆฌํด
SELECT MONTHS_BETWEEN( TO_DATE('2000/06/05'), TO_DATE('2000/09/23') ) COL1 FROM dual;
- ROUND(d[,F]) : F์ ์ง์ ๋ ๋จ์๋ก ๋ฐ์ฌ๋ฆผ
- F๊ฐ ์ฐ๋๋ผ๋ฉด ์ฐ๋ ๋จ์๋ก ๋ฐ์ฌ๋ฆผ
SELECT TO_CHAR( ROUND( TO_DATE( '20230601 113131', 'YYYYMMDD HH24MISS' ), 'YYYY' ), 'YYYYMMDD HH24MISS' ) YYYY1
, TO_CHAR( ROUND( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'YYYY' ), 'YYYYMMDD HH24MISS' ) YYYY2
, TO_CHAR( ROUND( TO_DATE( '20230715 113131', 'YYYYMMDD HH24MISS' ), 'MM' ), 'YYYYMMDD HH24MISS' ) MM1
, TO_CHAR( ROUND( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'MM' ), 'YYYYMMDD HH24MISS' ) MM2
, TO_CHAR( ROUND( TO_DATE( '20230716 113131', 'YYYYMMDD HH24MISS' ), 'DD' ), 'YYYYMMDD HH24MISS' ) DD1
, TO_CHAR( ROUND( TO_DATE( '20230716 123131', 'YYYYMMDD HH24MISS' ), 'DD' ), 'YYYYMMDD HH24MISS' ) DD2
, TO_CHAR( ROUND( TO_DATE( '20231231 112931', 'YYYYMMDD HH24MISS' ), 'HH24' ), 'YYYYMMDD HH24MISS' ) HH1
, TO_CHAR( ROUND( TO_DATE( '20231231 113031', 'YYYYMMDD HH24MISS' ), 'HH24' ), 'YYYYMMDD HH24MISS' ) HH2
, TO_CHAR( ROUND( TO_DATE( '20231231 113129', 'YYYYMMDD HH24MISS' ), 'MI' ), 'YYYYMMDD HH24MISS' ) MI1
, TO_CHAR( ROUND( TO_DATE( '20231231 113131', 'YYYYMMDD HH24MISS' ), 'MI' ), 'YYYYMMDD HH24MISS' ) MI2
FROM DUAL;
<< ๋ณํํจ์ >>
- TO_CHAR : DATEํ, NUMBERํ์ VARCHAR2ํ์ผ๋ก ๋ณํ
SELECT TO_CHAR(sysdate, 'YEAR') COL1, TO_CHAR(sysdate, 'MONTH') COL2, TO_CHAR(sysdate, 'DAY') COL3, TO_CHAR(1234, '00009') COL4, TO_CHAR(1234, '999,990') COL5 FROM dual;
- TO_DATE : CHAR, VARCHAR2ํ์ DATE ํ์ ์ผ๋ก ๋ณํ
SELECT TO_DATE('2000/06/16','YYYY/MM/DD') COL1, TO_DATE('20000616','YYYYMMDD') COL2 FROM dual;
- TO_NUMBER : CHAR, VARCHAR2์ ๋ฐ์ดํฐ ํ์ ์ ์ซ์ํ์์ผ๋ก ๋ณํ
SELECT TO_NUMBER('1210616') COL1 FROM dual;
'๊ฐ๋ฐ์ผ๊ธฐ ๐ป' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python] OSError: [E050] Can't find model 'en_core_web_sm' ์๋ฌ ํด๊ฒฐ (1) | 2024.03.16 |
---|---|
[JAVA] World Time API๋ก ์ธ๊ณ์๊ฐ ์์์ค๊ธฐ (0) | 2024.02.21 |
[DBMS] SqlDeveloper์์ DB ๋น๊ตํ๊ธฐ (0) | 2023.12.21 |
[Oracle] ํ์ฅ GROUP ํจ์ - GROUPPING() (2) | 2023.12.06 |
[Oracle] ํ์ฅ GROUP ํจ์ - CUBE() (0) | 2023.12.06 |