Ruth, Brice wrote:

> 
> I'm not having much luck looking through the MaxDB docs on putting 
> together a simple SQL stored procedure. I was hoping someone might be 
> able to help me with this simple TRIGGER that I'm trying to pull over 
> from a DB2 instance:
> 
> CREATE TRIGGER WEBTST.F58INSNJDT
>     BEFORE INSERT ON WEBTST.F58NONJDET
>     REFERENCING NEW AS NEW_ROW
>     FOR EACH ROW
>     MODE DB2ROW
>     BEGIN
>     DECLARE NEWID INTEGER ;
>     DECLARE C1 CURSOR FOR
>         SELECT MAX ( WEBTST . F58NONJDET . NJITM ) FROM WEBTST . 
> F58NONJDET ;
>     OPEN C1 ;
>     FETCH C1 INTO NEWID ;
>     IF NEW_ROW . NJITM = 0 THEN
>         SET NEWID = NEWID + 1 ;
>         SET NEW_ROW . NJITM = NEWID ;
>     END IF;
>     CLOSE C1 ;
>     END ;
> 
> Its purpose is quite simply to create a sequence/identity 
> column, in a 
> database that doesn't natively support it (DB2). But, in 
> bringing things 
> over to MaxDB, I want to maintain this as a trigger, so that I don't 
> need to change the table layouts at all.
> 

May be I misunderstood something: you want identity column/sequence?
Why don't you use our identity column? 

Its datatype is SERIAL (or some FIXED(n) DEFAULT SERIAL) and can be used
as described in
http://www.mysql.com/products/maxdb/how_tos/numbergen/howto_producenumgen_eng.html

Then you can perhaps get rid of the whole trigger-stuff...

Elke
SAP Labs Berlin


> Any assistance would be much appreciated!
> 
> Respectfully,
> Brice Ruth
> 
> -- 
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:    
http://lists.mysql.com/[EMAIL PROTECTED]

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

Reply via email to