469,306 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

problem with an insert

I have 2 insert statements within a procedure which are as follows:

INSERT INTO temp table (column1, col2 )
SELECT 'abc, 'b' FROM tab1 AS A
WHERE A.col1 = '0' --20030801
AND A.col2 < current timestamp;
INSERT INTO temp table (column1, col2 )
SELECT 'abc, fn_getval('val') FROM tab1 AS A
WHERE A.col1 = '0' --20030801
AND A.col2 < current timestamp;

The only differenece is that the 2nd query is using a function while
inserting the rows. The strange thing is that the 2nd query takes ages
to execute.
Can any one please help me with this.

Nov 12 '05 #1
2 904
How many rows are you inserting?

What is the full function definition?
Phil Sherman

chettiar wrote:
I have 2 insert statements within a procedure which are as follows:

INSERT INTO temp table (column1, col2 )
SELECT 'abc, 'b' FROM tab1 AS A
WHERE A.col1 = '0' --20030801
AND A.col2 < current timestamp;
INSERT INTO temp table (column1, col2 )
SELECT 'abc, fn_getval('val') FROM tab1 AS A
WHERE A.col1 = '0' --20030801
AND A.col2 < current timestamp;

The only differenece is that the 2nd query is using a function while
inserting the rows. The strange thing is that the 2nd query takes ages
to execute.
Can any one please help me with this.

Nov 12 '05 #2
chettiar wrote:
I have 2 insert statements within a procedure which are as follows:

INSERT INTO temp table (column1, col2 )
SELECT 'abc, 'b' FROM tab1 AS A
WHERE A.col1 = '0' --20030801
AND A.col2 < current timestamp;
INSERT INTO temp table (column1, col2 )
SELECT 'abc, fn_getval('val') FROM tab1 AS A
WHERE A.col1 = '0' --20030801
AND A.col2 < current timestamp;

The only differenece is that the 2nd query is using a function while
inserting the rows. The strange thing is that the 2nd query takes ages
to execute.
Can any one please help me with this.

Well.. what's in fn_getval()?
If e.g. fn_getval() references tempTable then DB2 would have to DAM the
results of the SELECT.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by newbie_mw | last post: by
5 posts views Thread by Juho Saarikko | last post: by
2 posts views Thread by Gunnar Vyenli | last post: by
3 posts views Thread by DarthMacgyver | last post: by
4 posts views Thread by Bradley Burton | last post: by
1 post views Thread by Net Virtual Mailing Lists | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.