STRAGG in Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
<p>I want to use STRAGG function in this env.:  Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production, PL/SQL Release 11.2.0.4.0 - Production, CORE 11.2.0.4.0 Production, TNS for Linux: Version 11.2.0.4.0 - Production, NLSRTL Version 11.2.0.4.0 - Production:</p>

<p>I have a view called <strong>V_USER_ROLE_DESC</strong></p>

<pre><code>LOGIN   DESC      

joanet  BS in ANDROID.C.3
joanet  DOB in ANDROID.C.3
joanet  DO in ANDROID.C.3
joanet  BS in ANDROID.C.4
joanet  UA in ANDROID.C.4
joanet  OV in ANDROID.C.4
joanet  OI in ANDROID.C.4
joanet  DO in ANDROID.C.4
joanet  DHoU in ANDROID.C.4
joanet  AOP in ANDROID.C.4
</code></pre>

<p>Executin this query </p>

<pre><code>select
  login ,
  sys.STRAGG( UNIT_ROLE_DESC || ' - ' ) as string
from
  V_USER_ROLE_DESC
where login = 'joanet'
group by
  login
;
</code></pre>

<p>This is the result:</p>

<pre><code>joanet  BS in ANDROID.C.3 - DOB in ANDROID.C.3 - DO in ANDROID.C.3 - BS in ANDROID.C.4 - UA in ANDROID.C.4 - OV in ANDROID.C.4 - OI in ANDROID.C.4 - DO in ANDROID.C.4 - DHoU in ANDROID.C.4 - AOP in ANDROID.C.4 - 
</code></pre>

<p>But without the where clause ...</p>

<pre><code>   select
      login ,
      sys.STRAGG( UNIT_ROLE_DESC || ' - ' ) as string
    from
      V_USER_ROLE_DESC
    --where login = 'joanet'
    group by
      login
    ;
</code></pre>

<p>this is the result:</p>

<pre><code>...
colau   DOB in ANDROID.D.2 - 
joanet  DOB in ANDROID.D.2 - 
sisa    DOB in ANDROID.D.2 - 
...
</code></pre>

<p>Using </p>

<pre><code>SELECT login ,listagg(unit_role_desc,' - ') WITHIN GROUP (ORDER BY unit_role_desc) AS STRING FROM v_user_role_desc WHERE 1=1 GROUP BY LOGIN;
</code></pre>

<p>I have this error</p>

<p><strong>ORA-01489: result of string concatenation is too long</strong></p>