문자 관련 함수
2024. 6. 7. 20:03ㆍSQL
LOWER / UPPER / INITCAP
- 컬럼의 문자 또는 문자열을 소문자, 대문자, 첫 글자만 대문자로 변환해서 반환
- LOWER / UPPER INITCAP(STRING)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- LOWER : 모두 소문자로 변환 | |
SELECT LOWER('WELCOME TO MY WORLD') FROM DUAL; | |
-- 결과 : welcome to my world | |
-- UPPER | |
SELECT UPPER('welcome to my world') FROM DUAL; | |
-- 결과 : WELCOME TO MY WORLD | |
-- INICAP | |
SELECT INITCAP('welcome to my world') from dual; | |
-- 결과 : Welcome To My World |
문자 처리 함수 CONCAT
- 컬럼의 문자 혹은 문자열을 두 개 전달받아 하나로 합친 후 반환
- 작성법
CONCAT(STRING, STRING)
** 함수 CONCAT과 연산자 || 차이점
CONCAT : 두 개의 문자열을 결합하고 두 개 이상은 불가능 -> 성+이름 붙일 때 사용
CONCAT(STRING1, STRING2)
|| : 두 개 이상의 문자열을 결합할 때 사용
STRING1 || STRING2 || STRING3 ||...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONCAT('가나다라', 'ABCD') FROM DUAL; | |
SELECT '가나다라' || 'ABCD' || 'QWERQWER' FROM DUAL; |

