Using global temporary tables in db2

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
dohertys
Participant
Posts: 39
Joined: Thu Oct 11, 2007 3:26 am
Location: Sheffield

Using global temporary tables in db2

Post by dohertys »

I'm thinking of using a db2 stage to..

1. In the open command, declare a global temporary table
2. Use the input rows from datastage to insert records into the global temporary table
3. Use a close command to run some sql using that temporary table.

Should this work?

When I use a Write Method of 'Write' and Write Mode of 'Append', I get the following error message:
The table: SESSION.GTEMP1 does not exist!; you cannot use the append or truncate modes.
If I change the Write Mode to 'Create' or 'Replace', will this do what I want?

Will the Create/Replace specified in my Write Mode happen before or after I declare my Global Temporary Table in the 'Open command'?

(I've not tried it out, because it would also involve having to grant my db2 user permission to create tables).

Has anyone else done this sort of thing before?

Thanks
mk_ds09
Participant
Posts: 72
Joined: Sun Jan 25, 2009 4:50 pm
Location: Pune

Post by mk_ds09 »

what i will suggest you to write the unix scripts which can do all the operations what you are doing..!

in that one session u can declare the temp table and all the operations that you want to perform and then u can close the session so that the table will not be available..

the error which is there in your post seems to be issue with session as temparory table is not available..

hope this helps..

-----------------------

MK
dohertys
Participant
Posts: 39
Joined: Thu Oct 11, 2007 3:26 am
Location: Sheffield

Post by dohertys »

Thanks for you suggestion.

I'm going to try that out and also look at trying to get a real ( non-temporary) table created as a staging table, then doing my close command to run the sql as I originally mentioned.

I'll go with whichever method people are more comfortable with here.

Thanks
Post Reply