473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 991
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
5
by: Juho Saarikko | last post by:
I made a Python script which takes Usenet message bodies from a database, decodes uuencoded contents and inserts them as Large Object into a PostGreSQL database. However, it appears that the to...
2
by: Gunnar Vøyenli | last post by:
Hi Some days ago I posted a problem with a query. Thaks to Dave and John, I got a little closer to a solution. Their suggestion was a solution to my problem as I stated it, but the real problem...
3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
4
by: Bradley Burton | last post by:
I'm using Allen Brown's code for audit logging (http://allenbrowne.com/AppAudit.html), but I'm having a problem. My aud table doesn't populate with the tracking info at all. I think it might be a...
1
by: Net Virtual Mailing Lists | last post by:
Hello, I have 3 tables which are joined that I need to create a summation for and I just cannot get this to work. Here's an example: CREATE table1 ( id1 INTEGER, title1 VARCHAR
7
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the...
0
by: ZoeNet | last post by:
Hi all, The table structures are below. The table category_cat is built on the adjacency model (where the parent and child entries are both stored in the same table). For my problem, I've...
3
by: jaddi1 | last post by:
Hi, I am trying to make a multi-level drop-down menu similar to what is seen here: http://www.cssplay.co.uk/menus/simple_vertical.html. My problem is that some of the menu will be populated from...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.