SQL Language (MOSC)

MOSC Banner

Stings Size Limitation

edited Feb 27, 2012 1:52AM in SQL Language (MOSC) 2 commentsAnswered
Hello All

I got a problem  with an IN clause query  with too many literals  or String concatination

ex:

  1  select listagg(rn,',') within group (order by 1)
  2  from (
  3  select rownum rn  from dual connect by level < 2000
  4* )
SQL> /
select rownum rn  from dual connect by level < 2000
                       *
ERROR at line 3:
ORA-01489: result of string concatenation is too long


(or)

declare
l_empno varchar2(4000 char);


begin

select listagg(rn,',') within group (order by 1) into l_empno
from (
select rownum rn  from dual connect by level < 2000);

l_empno := l_empno||','||l_empno;

select * into l_empno from emp where empno in l_empno;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center