Skip to content
September 4, 2015 / doganay

ORA-30009: Not enough memory for CONNECT BY operation


Problem:

drop table t1;
CREATE TABLE t1 (col1 number);

SQL> INSERT INTO t1
2 WITH w1 AS
3 (SELECT ROWNUM r FROM dual CONNECT BY ROWNUM <= 2000000)
4 SELECT ROWNUM
5 FROM w1
6 /
INSERT INTO t1
*
ERROR at line 1:
ORA-30009: Not enough memory for CONNECT BY operation


Solution:

declare
v_count number;
v_range number;
begin
v_count:=2;
v_range:=1000000;
for i in 0..v_count-1 loop
INSERT /*+ append */ INTO t1
WITH w1 AS (SELECT ROWNUM+v_range*i r FROM dual CONNECT BY ROWNUM <= v_range)
SELECT r
FROM w1;
commit;
end loop;
end;
/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: