Re: Hi all

From: Tim X <>
Date: Tue, 18 Aug 2009 18:17:03 +1000
Message-ID: <>

pal <> writes:

> Can any one tell me how to declare a temporary table in a trigger(like
> in SQL Server)?

OMG! Do NOT do it!

  1. Avoid triggers unless there is a very good reason and no other solution will work. Triggers can easily get unmanageable and are effectively side effects that can make maintenance and debugging a nightmare (especially if different teams end up doing the maintenance).
  2. Creating tables is a DDL (Data Definition Language) statement and therefore causes an implicit commit. This would cause unexpected behavior with transaction management etc (actually, I don't think you can have DDL in triggers for this reason).
  3. Maybe consider a temporary global table which is created already and take advantage of its support for transaction independence etc. While its not clear why you want to create a table in a trigger, it is likely that the features of a temporary global table would provide what you are after - though I'm totally guessing of course as we have no details on what your trying to do).


tcross (at) rapttech dot com dot au
Received on Tue Aug 18 2009 - 03:17:03 CDT

Original text of this message