Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 18 Feb 2005 @ 11:05:33 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Upsert with added Update in Multiload
 
From:   Holzapfel, Christian

Hi all,

I' m writing a mulitload script which should do two things from one record:

First, do an UPSERT, if a row for a specific ID exists, just add the values from the record, if it doesn't, insert it.

Next, do an UPDATE all the time to a different table, adding some values in a status record.

So far the statement looks like this, but Multiload dislikes the second update which actually does not really belong to the UPSERT, and therefore I get a ML error (**** 09:43:34 UTY1612 Invalid 'INSERT MISSING UPDATE ROWS' .dml request).

     .DML LABEL Pos DO INSERT FOR MISSING UPDATE ROWS;
       UPDATE ch185017.Fakten_Filiale SET
          Menge=Menge+:in_MENGE (decimal(7,0)),
          Umsatz=Umsatz + :in_UMSATZ (decimal(7,0))
       WHERE Filiale=:in_FIL (decimal(7,0))
       AND Datum(FORMAT 'YYMMDD')=:in_DATUM
       AND EAN=:in_EAN (decimal(13,0))
       ;

       INSERT INTO ch185017.Fakten_Filiale (Datum, Filiale, EAN, Menge, Umsatz)
       VALUES(
          :in_DATUM (FORMAT 'YYMMDD'),
          :in_FIL (decimal(7,0)),
          :in_EAN (decimal(13,0)),
          :in_MENGE(decimal(9,0)),
          :in_UMSATZ (decimal(10,0))
       );

       UPDATE ch185017.Load_Log SET
          SatzAnz=SatzAnz+1,
          Menge=Menge+ :in_MENGE (decimal(7,0)),
          Umsatz=Umsatz + :in_UMSATZ (decimal(7,0))
       WHERE Filiale=:in_FIL (decimal(7,0))
       AND Datum(FORMAT 'YYMMDD')=:in_DATUM
       ;

Does anbody know a way around this problem?

Thanks in advance!


regards

Christian Holzapfel
------------------------------------------------
NCR GmbH
Teradata A Division of NCR
Gesch=E4ftstelle D=FCsseldorf



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023