Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 18 Sep 2003 @ 14:27:25 GMT


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


Subj:   Re: How to create sys generated keys
 
From:   Little, Doug

Narayan

Thanks for the thoughts, unfortunately it looks like there are internal constraints that prohibit this approach.

**** 09:37:59 UTY1008 RDBMS failure: 5529, A triggered statement inside a row trigger can not refer to a table that is being changed by the row trigger.

I tried creating a before & after trigger and neither seemed to work.

This was the def

CREATE TABLE SEQ (TABLENAME CHAR(30), NEXTREC INTEGER NOT NULL DEFAULT 0)
UNIQUE PRIMARY INDEX (TABLENAME);

INSERT INTO SEQ VALUES('TPTB1',1);

REPLACE TRIGGER NEXTREC ENABLED AFTER INSERT ON TPTB1
    FOR EACH ROW  (
 UPDATE SEQ SET NEXTREC = NEXTREC + 1 WHERE TABLENAME='TPTB1';
        ) ;

INSERT INTO tptb1 (  a1,a2,a3,a4  )
   SELECT :cc1 ,:cc2 (Date, Format 'YYYY/MM/DD') ,:cc3, NEXTREC FROM SEQ
WHERE TABLENAME='TBTB1' ;

Thanks for the help. Any more ideas?

Doug Little
Data Architecture Services
E1E007D - Itek Building
Ford Motor Co



     
  <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