|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Help w/ SQL stored procedure
From: Ruth, Brice (bruth
fiskars.com)
Date: Thu Apr 29 2004 - 15:56:58 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Any assistance would be much appreciated!
Respectfully,
Brice Ruth
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]