문자열 함수
SUBSTR(문자열, 시작위치, 길이)
SELECT SUBSTR('HELLO', 1, 3) FROM DUAL;
SELECT SUBSTR('HELLO', 3) FROM DUAL;
SELECT NAME, SUBSTR(BIRTHDAY, 6, 2) MONTH FROM MEMBER;
SELECT * FROM MEMBER WHERE SUBSTR(PHONE, 1, 3) = '011';
SELECT * FROM MEMBER WHERE SUBSTR(BIRTHDAY, 6, 2) IN('07', '08', '09');
SELECT * FROM MEMBER WHERE
PHONE IS NULL AND SUBSTR(BIRTHDAY, 6, 2) IN('07', '08', '09');
SELECT CONCAT('홍','길동') FROM DUAL;
SELECT TRIM(' HELLO ') FROM DUAL;
-- 앞 뒤 공백 제거
SELECT LTRIM(' HELLO ') FROM DUAL;
-- 왼쪽 공백 제거
SELECT RTRIM(' HELLO ') FROM DUAL;
-- 오른쪽 공백 제거
SELECT UPPER('NewLec') FROM DUAL;
SELECT LOWER('NewLec') FROM DUAL;
SELECT * FROM MEMBER WHERE LOWER(ID) = LOWER('newlec');
REPLACE(문자열, 찾는 문자열, 대치할 문자열)
TRANSLATE(문자열, 찾는 문자열, 대치할 문자열)
SELECT REPLACE('WHERE WE ARE', 'WE', 'YOU') FROM DUAL;
SELECT TRANSLATE('WHERE WE ARE', 'WE', 'YO') FROM DUAL;
-- W > Y, E > O로 대치
SELECT NAME, REPLACE(ADDRESS, ' ', '') FROM MEMBER
SELECT LPAD('HELLO', 5) FROM DUAL;
SELECT LPAD('HELLO', 10) FROM DUAL;
SELECT LPAD('HELLO', 10, 2) FROM DUAL;
SELECT LPAD('HELLO', 11, '김') FROM DUAL;
SELECT RPAD('HELLO', 8, '2') FROM DUAL;
SELECT RPAD(NAME, 6, '_') FROM MEMBER;