Create Global Temp Table question

Amy C. Whitehead

Create Global Temp Table question
Hi,
Due to being on v5 in production, we have to use the non-indexable 'create
global temp table' syntax for GTTs. Eventhough this execution is
successfull, we always get a -601. A -601 says that the table already
exists. How do we prevent this error message?
Here is the syntax that is embedded in the cobol program:
EXEC SQL
CREATE GLOBAL TEMPORARY TABLE SESSION.TEMPTAB
(cola CHAR(20) NOT NULL)
END-EXEC.

Thanks,
Amy Whitehead



John Hardy

Re: Create Global Temp Table question
(in response to John Cameron)
Although the actual data only exists during the current unit of work, the
Table (unlike the V6 Declared Temporary Table) is defined on the Catalogue.
You must either Drop it before the Create or Reuse it.


On Wed, 3 Jan 2001 09:43:18 -0500, Amy C Whitehead <[login to unmask email]> wrote:

>Hi,
>Due to being on v5 in production, we have to use the non-indexable 'create
>global temp table' syntax for GTTs. Eventhough this execution is
>successfull, we always get a -601. A -601 says that the table already
>exists. How do we prevent this error message?
>Here is the syntax that is embedded in the cobol program:
>EXEC SQL
> CREATE GLOBAL TEMPORARY TABLE SESSION.TEMPTAB
> (cola CHAR(20) NOT NULL)
>END-EXEC.
>
>Thanks,
>Amy Whitehead
>
>
>





John Cameron

Re: Create Global Temp Table question
(in response to Amy C. Whitehead)
Amy,

You only need to define the global temporary table once. Your COBOL
program does
not need to re-create it. Only the definition is stored in the catalog.
Only when your
program is using it does the GTT actually "exist." If your GTT has been
defined, remove the
Create GTT DDL from your program. If multiple users are running the same
program, each
user will have their own copy of the GTT.

- John

John Cameron
[login to unmask email]
651.631.7188






Amy C
Whitehead To: [login to unmask email]
<[login to unmask email] cc:
OM> Subject: Create Global Temp Table question
Sent by: DB2
Data Base
Discussion
List
<[login to unmask email]
OM>


01/03/01
08:43 AM
Please
respond to
DB2 Data Base
Discussion
List






Hi,
Due to being on v5 in production, we have to use the non-indexable 'create
global temp table' syntax for GTTs. Eventhough this execution is
successfull, we always get a -601. A -601 says that the table already
exists. How do we prevent this error message?
Here is the syntax that is embedded in the cobol program:
EXEC SQL
CREATE GLOBAL TEMPORARY TABLE SESSION.TEMPTAB
(cola CHAR(20) NOT NULL)
END-EXEC.

Thanks,
Amy Whitehead