'[예제] 이메일에서 아이디와 도메인 분리하기'에 해당되는 글 1건

  1. 2016.12.30 [예제] 이메일에서 아이디와 도메인 분리하기

select * from tab;

select * from emp1;


-- 필드 추가

alter table emp1

add (email varchar2(30));

select * from emp1;


-- 이메일 수정

update emp1 set email='ssss@naver.com' where hiredate like '__/02%';

update emp1 set email='aaaaa@nate.com' where ename like '%A%';

update emp1 set email='nnnnn@daum.com' where ename like '%N%';

update emp1 set email='null@hanmail.net' where email is null;


commit;


--------------------------------------------------------------------------------


-- 이름    이메일            아이디 도메인

-- smith  null@hanmail.net  null  hanmail.net

select ename 이름, email 이메일, substr(email, 1, instr(email, '@') -1) 아이디, substr(email, instr(email, '@') +1, length(email)) 도메인 from emp1;

select ename, email, substr(email, 1, instr(email, '@') -1) 아이디, substr(email, instr(email, '@') +1, length(email) - instr(email, '@')) 도메인 from emp1;

'응용 SoftWare > Oracle' 카테고리의 다른 글

날짜 처리 함수  (0) 2017.01.02
General Function  (0) 2017.01.02
문자열 처리 함수  (0) 2016.12.30
숫자 함수  (0) 2016.12.30
테이블 예명  (0) 2016.12.30
Posted by Hyun CHO
,