Elke Schmidtke wrote:
> 
> Hi,
> I try to create a temp table in a trigger:
> CREATE TRIGGER TR_INSUPD_ATZ_WB FOR DBA.T_ATZ_WB
> AFTER INSERT, UPDATE EXECUTE (
>     CREATE TABLE TEMP.ATZ_VIEW (
>      BEGINN DATE,
>      ENDE DATE,
>      BESETZTE_STD FIXED(5,2),
>      FREIE_STD FIXED(5,2),
>      MODELL CHAR(2));
> )
> 
> But get the message:
> Base table or view already exists;-6000 POS(104) Duplicate table
> name:ATZ_VIEW
> 
> In the archive I found this
> http://lists.mysql.com/maxdb/21377
> and expected that i can use temp tables in a trigger ?
> 
> Elke

Do you receive error -6000 during creation of the trigger or during
corresponding insert/update ?
If during creation: does the temp-table ATZ_view exist at that moment?
If during execution: does the temp-table ATZ-view exist before the FIRST
execution of corresponding insert/update? And during which insert/update
(the first or one of the next ones) does the problem occur and how many
rows are handled during this command (insert...select or pure insert,
updatefor exactly one row or for several ones)?

If the problem occurs during execution, the answer will perhaps be very
easy:
Each row firing the corresponding trigger will try to create the
temp-table.
And the first firing row will succeed, all the others will receive -6000
of course. Therefore (if the real code looks similar to that shown above
without any drop temp-table) you have to get rid of this temp-table
before leaving the trigger or react correctly if the error -6000 occurs
and you want to add some info concerning the current row to the info put
into that table during the trigger-firings before.

Elke
SAP Labs Berlin


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to