By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,585 Members | 2,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,585 IT Pros & Developers. It's quick & easy.

problem with an insert

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.