If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Check that Global Temporary Table Exists or Not

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-06-04, 00:30
jsp2999 jsp2999 is offline
Registered User
 
Join Date: Jul 2004
Posts: 76
Check that Global Temporary Table Exists or Not

System Information:

OS: Windows XP Professional
Database: DB2 UDB V8.1.3.132 Fixpack: 3

Is there any way to find out whether any specific global temporary table alreay exists in the session or not?

Thanks in advance. With Big Hope,

Jai
Dare to Dream!!!
Reply With Quote
  #2 (permalink)  
Old 08-06-04, 05:44
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Arrow

You cannot list tables for schema session (I've tried)

But just select the first row, and you'll know

Cheers
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #3 (permalink)  
Old 08-10-04, 17:42
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
The alternate solution :

In the variable declaraion section
DECALRE DGTT_FOUND SMALLINT DEFAULT 0 ;

In the contine handler section, add an additional handler
DECLARE CONTINUE HANDLER FOR ‘42710’
SET DGTT_FOUND=1 ;

In the SP body
DECLARE GLOBAL TEMPERORY TABLE SESSION.T1 ( I INT) ;
IF (DGTT_FOUND=1) THEN
......
...
ELSE
.....
.....
END IF ;


Then depending on the value of DGTT variable you can decide what you want to do ... For checking the existence of a dgtt, make sure you do not use the 'WITH REPLACE' option

I have tried this on DB2 V8 on ZOS and works ... ( I had to code this continue handler because zos does not support the WITH REPLACE Option )... I don't see a reason why it will not work on LUW

HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On