{"id":4400,"date":"2019-01-15T15:30:15","date_gmt":"2019-01-15T06:30:15","guid":{"rendered":"http:\/\/haisins.epac.to\/wordpress\/?p=4400"},"modified":"2019-01-15T15:30:15","modified_gmt":"2019-01-15T06:30:15","slug":"listagg-function-%ec%82%ac%ec%9a%a9%eb%b2%95","status":"publish","type":"post","link":"http:\/\/haisins.synology.me\/wordpress\/?p=4400","title":{"rendered":"LISTAGG Function \uc0ac\uc6a9\ubc95"},"content":{"rendered":"<p><a href=\"file:\/\/\/C:\/Users\/Administrator\/Documents\/#_Toc351980195\">\u00a0<\/a><\/p>\n<p><a name=\"_Toc351980186\"><\/a>1 \ubaa9\uc801<\/p>\n<p>\uc810\ucc28\uc801\uc73c\ub85c 10g \uc5d0\uc11c 11g\ub85c \ubc84\uc804\uc5c5\uc774 \ub418\uace0 \uc788\ub294 \uc2dc\uc7a5\uc5d0\uc11c Oracle 11g\uc5d0\uc11c \uc0c8\ub86d\uac8c \uc18c\uac1c\ub41c \uae30\ub2a5\uc744 \uc0b4\ud3b4\ubcf4\uace0\uc790 \ud55c\ub2e4. SQL\ubb38\uc744 \uc0ac\uc6a9\ud558\ub2e4\ubcf4\uba74 \uceec\ub7fc\ubcc4\ub85c \uac00\ub85c\ub85c \uc815\ub9ac\ud574\uc57c \ud560\ub54c\uac00 \uc788\ub2e4 10g \ubc84\uc804\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub358 SYS_CONNECT_BY_PATH \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubcf5\uc7a1\ud588\ub358 SQL\uc774 LISTAGG Function\uc744 \uc0ac\uc6a9\ud558\uc5ec \uac04\ub2e8\ud558\uba70 \ud6a8\uacfc\uc801\uc778 SQL\ubb38\uc744 \uc791\uc131\uc744 \ud558\uae30 \uc704\ud55c \ubaa9\uc801\uc785\ub2c8\ub2e4.<\/p>\n<h3><a name=\"_Toc351980187\"><\/a>2 TEST \ud658\uacbd\uad6c\uc131<\/h3>\n<p>n \ubc84\uc804\uc815\ubcf4 \ud655\uc778 \uc2a4\ud06c\ub9bd\ud2b8<\/p>\n<table style=\"width: 867px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 863px;\" valign=\"top\">&#8212; Check Oracle Version &#8212;<\/p>\n<p>SQL) select * from version;<\/p>\n<p>BANNER<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 &#8211; 64bit Production<\/p>\n<p>PL\/SQL Release 11.2.0.2.0 &#8211; Production<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n Table \uc0dd\uc131 \uc2a4\ud06c\ub9bd\ud2b8<\/p>\n<table style=\"width: 871px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 867px;\" valign=\"top\">&#8212; Make table scritp<\/p>\n<p>SQL) create table emp (deptno number, ename varchar2(1000), hiredate date);<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n Data \uc0bd\uc785 \uc2a4\ud06c\ub9bd\ud2b8<\/p>\n<table style=\"width: 873px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 869px;\" valign=\"top\">&#8212; Data insert script<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(10, &#8216;CLARK &#8216;, TO_DATE(&#8216;19810609&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(10, &#8216;KING&#8217;, TO_DATE(&#8216;19811117&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(10, &#8216;MILLER&#8217;, TO_DATE(&#8216;19820123&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(20, &#8216;ADAMS&#8217;, TO_DATE(&#8216;19830112&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(20, &#8216;FORD&#8217;, TO_DATE(&#8216;19811203&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(20, &#8216;JONES&#8217;, TO_DATE(&#8216;19810402&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(20, &#8216;SCOTT&#8217;, TO_DATE(&#8216;19821209&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(20, &#8216;SMITH&#8217;, TO_DATE(&#8216;19801217&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(30, &#8216;ALLEN&#8217;, TO_DATE(&#8216;19810220&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(30, &#8216;BLAKE&#8217;, TO_DATE(&#8216;19810501&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(30, &#8216;JAMES&#8217;, TO_DATE(&#8216;19811203&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(30, &#8216;MARTIN&#8217;, TO_DATE(&#8216;19810928&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(30, &#8216;TURNER&#8217;, TO_DATE(&#8216;19810908&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>INSERT INTO EMP(DEPTNO, ENAME, HIREDATE) VALUES(30, &#8216;WARD&#8217;, TO_DATE(&#8216;19810222&#8217;, &#8216;YYYYMMDD&#8217;));<\/p>\n<p>COMMIT;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n \ub370\uc774\ud130 \ud655\uc778 \uc2a4\ud06c\ub9bd\ud2b8<\/p>\n<table style=\"width: 869px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 865px;\" valign=\"top\">&#8212; Query EMP<\/p>\n<p>SQL) SELECT DEPTNO,ENAME,TO_CHAR(HIREDATE, &#8216;YYYY-MM-DD&#8217;) HIREDATE<\/p>\n<p>FROM EMP;<\/p>\n<p>DEPTNO ENAME HIREDATE<\/p>\n<p>&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>10 CLARK 1981-06-09<\/p>\n<p>10 KING 1981-11-17<\/p>\n<p>10 MILLER 1982-01-23<\/p>\n<p>20 ADAMS 1983-01-12<\/p>\n<p>20 FORD 1981-12-03<\/p>\n<p>20 JONES 1981-04-02<\/p>\n<p>20 SCOTT 1982-12-09<\/p>\n<p>20 SMITH 1980-12-17<\/p>\n<p>30 ALLEN 1981-02-20<\/p>\n<p>30 BLAKE 1981-05-01<\/p>\n<p>30 JAMES 1981-12-03<\/p>\n<p>30 MARTIN 1981-09-28<\/p>\n<p>30 TURNER 1981-09-08<\/p>\n<p>30 WARD 1981-02-22<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><a name=\"_Toc351980188\"><\/a>3 \ubc84\uc804\ubcc4 SQL \uc0dd\uc131\ubc29\ubc95<\/h3>\n<p>n DEPTNO\ub97c GROUP\uc73c\ub85c \ubb36\uc740 \ud6c4 ENAME \uac12\uc744 \uac00\ub85c\ub85c \ub098\uc5f4<\/p>\n<h4><a name=\"_Toc351980189\"><\/a>3.1 10g \ud65c\uc6a9\uc608\uc2dc<\/h4>\n<table style=\"width: 860px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 856px;\" valign=\"top\">&#8212; Query aggregated ename in 10g version<\/p>\n<p>col deptno for 999,999,999<\/p>\n<p>col aggregated_enames for a50<\/p>\n<p>SELECT DEPTNO, SUBSTR(MAX(SYS_CONNECT_BY_PATH(ENAME, &#8216;, &#8216;)), 2) AGGREGATED_ENAMES<\/p>\n<p>FROM (SELECT DEPTNO, ENAME, TO_CHAR(HIREDATE, &#8216;YYYY-MM-DD&#8217;) HIREDATE,<\/p>\n<p>ROW_NUMBER() OVER(PARTITION BY DEPTNO ORDER BY HIREDATE) CNT<\/p>\n<p>FROM EMP) T<\/p>\n<p>CONNECT BY PRIOR CNT=CNT-1 AND PRIOR DEPTNO = DEPTNO<\/p>\n<p>START WITH CNT = 1<\/p>\n<p>GROUP BY DEPTNO<\/p>\n<p>ORDER BY 1;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>DEPTNO AGGREGATED_ENAMES<\/p>\n<p>&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>10 CLARK, KING, MILLER<\/p>\n<p>20 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>30 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>n DEPTNO \uac12\uc744 grouping \ud558\uae30\uc704\ud574 ROWNUM() \ud568\uc218\ub97c \uc0ac\uc6a9\ud55c\ud6c4 connect by prior\ub97c \uc774\uc6a9\ud558\uc5ec<\/p>\n<p>\uc5f0\uacb0\ud55c\ub4a4, SYS_CONNECT_BY_PATH \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uac12\uc744 \uac00\ub85c\ub85c \ub098\uc5f4\ud558\ub294 \ubc29\ubc95<\/p>\n<p>\ud558\uc9c0\ub9cc 11g \ubd80\ud130\ub294 \ubcf5\uc7a1\ud558\uac8c \uad6c\ud604\ud560 \ud544\uc694\ud558\uc9c0 \uc54a\uace0 LISTAGG Function \uc0ac\uc6a9\ud568\uc73c\ub85c\uc11c<\/p>\n<p>\uac04\ub2e8\ud788 \uad6c\ud604\ud560\uc218 \uc788\ub2e4.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><a name=\"_Toc351980190\"><\/a>3.2 11g \ud65c\uc6a9\uc608\uc2dc<\/h4>\n<h5><a name=\"_Toc351980191\"><\/a>3.2.1 LISTAGG \ud568\uc218 Syntax<\/h5>\n<table style=\"width: 860px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 856px;\" valign=\"top\">Syntax : LISTAGG( [,]) WITHIN GROUP (ORDER BY ) [OVER (PARTITION BY )]<\/p>\n<p>The following elements are mandatory:<\/p>\n<p>1) the column or expression to be aggregated;<\/p>\n<p>2) the WITHIN GROUP keywords;<\/p>\n<p>3) the ORDER BY clause within the grouping<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n LISTAGG \ud568\uc218 \uc0ac\uc6a9\ud558\uc5ec \uac00\ub85c\ub85c \uc815\ub82c<\/p>\n<table style=\"width: 860px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 856px;\" valign=\"top\">SELECT DEPTNO, LISTAGG(ENAME, &#8216;, &#8216;) WITHIN GROUP (ORDER BY HIREDATE) AS AGGREGATED_ENAMES<\/p>\n<p>FROM EMP<\/p>\n<p>GROUP BY DEPTNO;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>DEPTNO AGGREGATED_ENAMES<\/p>\n<p>&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>10 CLARK, KING, MILLER<\/p>\n<p>20 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>30 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>&#8211; detpno \uceec\ub7fd\uc73c\ub85c \uadf8\ub8f9\uc73c\ub85c \ubb36\uc740 \ud6c4, \uac00\ub85c\ub85c \ub098\uc5f4\ud558\uace0\uc790 \ud558\ub294 \uceec\ub7fc ename\uc744 LISTAGG()\uc5d0 \uba85\uc2dc\ud574\uc8fc\uba74<\/p>\n<p>\ub41c\ub2e4. WITHIN GROUP() \ud568\uc218\uc5d0\uc11c\ub294 \uac00\ub85c\ub85c \ub098\uc5f4\ud558\uace0\uc790 \ud558\ub294 \uc21c\uc11c\ub97c order by\ub85c \uc9c0\uc815\ud558\uba74 \ub05d\ub09c\ub2e4.<\/p>\n<p>\uc704\uc758 10g\uc758 \uacb0\uacfc\uac12\uacfc \ub3d9\uc77c\ud55c \uacb0\uacfc\uac12\uc744 \uac00\uc9c8 \uc218 \uc788\ub2e4.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><a name=\"_Toc351980192\"><\/a>4 LISTAGG \ud568\uc218\uc758 \ud65c\uc6a9<\/h3>\n<p>n 10g\uc758 \ubd84\uc11d\ud568\uc218 \ucc98\ub7fc \uc5ec\ub7ec\uceec\ub7fc \ub370\uc774\ud130\uc640 \ub3d9\uc2dc\uc5d0 \ud45c\ud604<\/p>\n<h4><a name=\"_Toc351980193\"><\/a>4.1 OVER(PARTITION BY DEPTNO) \uc0ac\uc6a9\uad6c\ubb38<\/h4>\n<p>n &#8211; LISTAGG \uad6c\ubb38\uc5d0 OVER(PARTITION BY DEPTNO) \uad6c\ubb38\uc744 \ucd94\uac00\ud560 \uacbd\uc6b0, \ubd84\uc11d\ud568\uc218\ucc98\ub7fc \uae30\uc874 \uceec\ub7fc\ub4e4\uacfc \uac19\uc774 \ubcfc \uc218 \uc788\ub2e4.<\/p>\n<table style=\"width: 853px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 849px;\" valign=\"top\">&#8212; Query<\/p>\n<p>SELECT DEPTNO,ENAME,HIREDATE, LISTAGG(ENAME, &#8216;, &#8216;) WITHIN GROUP (ORDER BY HIREDATE) OVER(PARTITION BY DEPTNO) AS AGGREGATED_ENAMES FROM EMP;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>DEPTNO ENAME HIREDATE AGGREGATED_ENAMES<\/p>\n<p>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>10 CLARK 09-JUN-81 CLARK, KING, MILLER<\/p>\n<p>10 KING 17-NOV-81 CLARK, KING, MILLER<\/p>\n<p>10 MILLER 23-JAN-82 CLARK, KING, MILLER<\/p>\n<p>20 SMITH 17-DEC-80 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>20 JONES 02-APR-81 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>20 FORD 03-DEC-81 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>20 SCOTT 09-DEC-82 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>20 ADAMS 12-JAN-83 SMITH, JONES, FORD, SCOTT, ADAMS<\/p>\n<p>30 ALLEN 20-FEB-81 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>30 WARD 22-FEB-81 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>30 BLAKE 01-MAY-81 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>30 TURNER 08-SEP-81 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>30 MARTIN 28-SEP-81 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/p>\n<p>30 JAMES 03-DEC-81 ALLEN, WARD, BLAKE, TURNER, MARTIN, JAMES<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><a name=\"_Toc351980194\"><\/a>4.2 \uad6c\ubd84\uc790\uc5c6\uc774 \ub098\uc5f4<\/h4>\n<p>n LISTAGG \ud568\uc218\uc758 2\ubc88\uc9f8 \ud30c\ub77c\ub9c8\ud130 \uac12\uc744(\uad6c\ubd84\uc790) \uc544\ubb34\uac83\ub3c4 \uc548 \uc904 \uacbd\uc6b0, \ubaa8\ub4e0 \uac12\uc774 \uc5f0\uc18d\uc73c\ub85c \uc5f0\uacb0\ub418\ub294 \uac83\uc744 \ud655\uc778\ud560 \uc218 \uc788\ub2e4.<\/p>\n<table style=\"width: 845px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 841px;\" valign=\"top\">SELECT DEPTNO, LISTAGG(ENAME) WITHIN GROUP (ORDER BY HIREDATE) AS AGGREGATED_ENAMES<\/p>\n<p>FROM EMP<\/p>\n<p>GROUP BY DEPTNO;<\/p>\n<p>DEPTNO AGGREGATED_ENAMES<\/p>\n<p>&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>10 CLARKKINGMILLER<\/p>\n<p>20 SMITHJONESFORDSCOTTADAMS<\/p>\n<p>30 ALLENWARDBLAKETURNERMARTINJAMES<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><a name=\"_Toc351980195\"><\/a>5 LISTAGG \ud568\uc218\uc758 \uc81c\uc57d\uc0ac\ud56d<\/h3>\n<p>n WITHIN GROUP \ud568\uc218 \ud30c\ub77c\ubbf8\ud130\uc5d0 \uac12\uc744 \uc8fc\uc9c0 \uc54a\uc744 \uacbd\uc6b0 \uc5d0\ub7ec<\/p>\n<table style=\"width: 842px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 838px;\" valign=\"top\">SELECT DEPTNO, LISTAGG(ENAME, &#8216;, &#8216;) WITHIN GROUP () AS AGGREGATED_ENAMES FROM EMP<\/p>\n<p>GROUP BY DEPTNO;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>LISTAGG(ENAME, &#8216;, &#8216;) WITHIN GROUP () AS AGGREGATED_ENAMES<\/p>\n<p>*<\/p>\n<p>ERROR at line 2:<\/p>\n<p>ORA-30491: missing ORDER BY clause<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n LISTAGG \ud568\uc218\uc758 2\ubc88\uc9f8 \ud30c\ub77c\ubbf8\ud130\uc5d0 ROWNUM \uac19\uc740 \uc608\uc57d\uc5b4\ub294 \uc0ac\uc6a9 \ubd88\uac00\ud568<\/p>\n<table style=\"width: 840px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 836px;\" valign=\"top\">SELECT DEPTNO, LISTAGG(ENAME, &#8216;(&#8216; || ROWNUM || &#8216;)&#8217;) WITHIN GROUP (ORDER BY HIREDATE) AS AGGREGATED_ENAMES FROM EMP GROUP BY DEPTNO;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>LISTAGG(ENAME, &#8216;(&#8216; || ROWNUM || &#8216;)&#8217;) WITHIN GROUP (ORDER BY HIREDATE) AS AGGREGATED_ENAMES<\/p>\n<p>*<\/p>\n<p>ERROR at line 2:<\/p>\n<p>ORA-30497: Argument should be a constant or a function of expressions in GROUP BY.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n LISTAGG \ud568\uc218\uc758 2\ubc88\uc9f8 \ud30c\ub77c\ubbf8\ud130\uc5d0 \uc608\uc57d\uc5b4\uac00 \uc544\ub2cc CHR() \ud568\uc218\ub97c \uc0ac\uc6a9\ud560 \uacbd\uc6b0, \uc5d0\ub7ec \uc5c6\uc774 \ucd9c\ub825\uc774 \uac00\ub2a5<\/p>\n<table style=\"width: 839px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 835px;\" valign=\"top\">SELECT DEPTNO, LISTAGG(ENAME, &#8216;(&#8216; || CHR(DEPTNO+55) || &#8216;)&#8217;) WITHIN GROUP (ORDER BY HIREDATE) AS AGGREGATED_ENAMES FROM EMP GROUP BY DEPTNO;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>DEPTNO AGGREGATED_ENAMES<\/p>\n<p>&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>10 CLARK(A)KING(A)MILLER<\/p>\n<p>20 SMITH(K)JONES(K)FORD(K)SCOTT(K)ADAMS<\/p>\n<p>30 ALLEN(U)WARD(U)BLAKE(U)TURNER(U)MARTIN(U)JAMES<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>n LISTAGG \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\uc5ec String \uac12\uc744 \uac00\uc838\uc62c \ub54c \ub108\ubb34 \uae38\uc774\uac00 \uae34 \uac12\uc740 \uac00\uc838\uc62c \uc218 \uc5c6\uc74c\uc744 \ud655\uc778\ud560 \uc218 \uc788\ub294 \uc608\uc81c\uc774\ub2e4.<\/p>\n<p>n 4000 bytes \ubcf4\ub2e4 \ud070\uac12\uc744 \ubd99\uc5ec\uc11c \ucd9c\ub825\ud560\ub824\ub2e4 \ubcf4\ub2c8 ORA-1489 \ubc1c\uc0dd<\/p>\n<table style=\"width: 839px;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 835px;\" valign=\"top\">SELECT LISTAGG(OBJECT_NAME) WITHIN GROUP (ORDER BY NULL)<\/p>\n<p>FROM ALL_OBJECTS;<\/p>\n<p>&#8212; RESULT &#8212;<\/p>\n<p>FROM ALL_OBJECTS<\/p>\n<p>*<\/p>\n<p>ERROR at line 2:<\/p>\n<p>ORA-01489: result of string concatenation is too long<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 1 \ubaa9\uc801 \uc810\ucc28\uc801\uc73c\ub85c 10g \uc5d0\uc11c 11g\ub85c \ubc84\uc804\uc5c5\uc774 \ub418\uace0 \uc788\ub294 \uc2dc\uc7a5\uc5d0\uc11c Oracle 11g\uc5d0\uc11c \uc0c8\ub86d\uac8c \uc18c\uac1c\ub41c \uae30\ub2a5\uc744 \uc0b4\ud3b4\ubcf4\uace0\uc790 \ud55c\ub2e4. SQL\ubb38\uc744 \uc0ac\uc6a9\ud558\ub2e4\ubcf4\uba74 \uceec\ub7fc\ubcc4\ub85c \uac00\ub85c\ub85c \uc815\ub9ac\ud574\uc57c \ud560\ub54c\uac00 \uc788\ub2e4 10g \ubc84\uc804\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub358 SYS_CONNECT_BY_PATH \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubcf5\uc7a1\ud588\ub358 SQL\uc774 LISTAGG Function\uc744 \uc0ac\uc6a9\ud558\uc5ec \uac04\ub2e8\ud558\uba70 \ud6a8\uacfc\uc801\uc778 SQL\ubb38\uc744 \uc791\uc131\uc744 \ud558\uae30 \uc704\ud55c \ubaa9\uc801\uc785\ub2c8\ub2e4. 2 TEST \ud658\uacbd\uad6c\uc131 n \ubc84\uc804\uc815\ubcf4 \ud655\uc778 \uc2a4\ud06c\ub9bd\ud2b8 &#8212; Check Oracle Version &#8212; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3627,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":""},"categories":[9],"tags":[1141,1142],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/haisins.synology.me\/wordpress\/wp-content\/uploads\/2018\/03\/sql1.jpg?fit=489%2C345","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4400"}],"collection":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4400"}],"version-history":[{"count":2,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4400\/revisions"}],"predecessor-version":[{"id":4402,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4400\/revisions\/4402"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/3627"}],"wp:attachment":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4400"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}