View previous topic :: View next topic |
Author |
Message |
rublu Beginner
Joined: 14 Jun 2005 Posts: 5 Topics: 2
|
Posted: Tue Jun 14, 2005 3:58 pm Post subject: Global Temporary Table - |
|
|
Hi all,
In one of my application, an online tranaction will invoke our main program from where we are routed to many sub modules. In one of the sub modules we are declaring Global temporary tables and using that.
There is a possibility that the before end of transaction we may invoke the module that is declaring GTT again. If that scenario occurs, the program is abending with SQLCODE -601. So I need to drop the GTT after each time i finish my business with the GTT each time. Is there any other way where I can do this wihtout droping the table as such? _________________ ------------
Ruben |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12381 Topics: 75 Location: San Jose
|
Posted: Tue Jun 14, 2005 4:14 pm Post subject: |
|
|
Rublu,
Use a DECLARED Temporary table instead of CREATE Global temporary table. The advantage of a declared temporary table versus a global temporary table is that information about declared temporary tables is not entered into the DB2 catalog when the table is created. This will allow two or more declared temporary tables with the same fully qualified name can exist at the same time. The name of the table only has to be unique for the thread through which the table was created. With a global temporary table, the fully qualified table name must be unique, so you either have to single-thread whatever process is going to create and reference the table, or you have to ensure that every thread will have a unique ID associated with it.
Check this link for a detailed explanation of Working with temporary tables
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/1.2.1.2?SHELF=&DT=20010710165542&CASE=
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
rublu Beginner
Joined: 14 Jun 2005 Posts: 5 Topics: 2
|
Posted: Tue Jun 14, 2005 4:31 pm Post subject: |
|
|
Thanks Kolusu.
I am using Declared Global Temorary table only. More than that I am getting this sqlcode -601 when I tried to Declare this GTT before the transaction ends. So I have option other than dropping the table after all the work was done with the GTT. Then I can declare again I guess?
Now my question is when I invoke this module through the same transaction whether i will get the same probelm. i.e. During the multi thread transaction, whether the instance is unique for each time when I invoke or is it unique for the transaction? Because transaction is same for this application. Ifthe instance is same for the transaction always then it is not at all possible for me to use GTT here . _________________ ------------
Ruben |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12381 Topics: 75 Location: San Jose
|
Posted: Tue Jun 14, 2005 6:31 pm Post subject: |
|
|
rublu,
May be you are having the catalog entries from your old CREATE GTT?
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
schintala Beginner
Joined: 18 May 2005 Posts: 108 Topics: 31 Location: USA
|
Posted: Wed Jun 15, 2005 8:12 am Post subject: |
|
|
I think you may consider use of terminalID while declaring the global temporary table name. |
|
Back to top |
|
 |
|
|