- 예제쿼리
emp.ename 컬럼, 그리고 그룹번호로 emp.deptno 컬럼을 예로 들어 쿼리를 구성해 보자.
emp 테이블의 deptno, ename 컬럼은 아래와 같다.
10 CLARK
10 KING
10 MILLER
20 ADAMS
20 FORD
20 JONES
20 SCOTT
20 SMITH
30 ALLEN
30 BLAKE
30 JAMES
30 MARTIN
30 TURNER
30 WARD
emp 테이블의 deptno, ename 컬럼은 아래와 같다.
10 CLARK
10 KING
10 MILLER
20 ADAMS
20 FORD
20 JONES
20 SCOTT
20 SMITH
30 ALLEN
30 BLAKE
30 JAMES
30 MARTIN
30 TURNER
30 WARD
이것을
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
요렇게 바꿔보자...
- 참고사이트
- http://www.soqool.com/servlet/board?cmd=view&cat=100&subcat=1010&seq=58
- http://database.sarang.net/?inc=read&aid=14788&criteria=oracle&subcrit=qna&record_idx=21&currpg=1
- http://www.okjsp.pe.kr/seq/75731
- http://amnesis.tistory.com/4
- 9i이상에서요.col name format a50;select job,substr(replace(sys_connect_by_path(ename, ',' ),' ',''),2) namefrom(select job,ename,row_number() over(partition by job order by job,ename desc) r1,(LEAD(ename) over(partition by job order by job,ename desc)) r2from scott.emp)where r1 = 1start with r2 is nullconnect by prior ename = r2order siblings by r2;
ORA-30004 에러 발생시....대처방법]=================
댓글 없음:
댓글 쓰기