Hello:

I am trying to port some functionality from ORACLE to SAPDB with 
sequences and triggers. 

All I really want to do is increment the 'FACEID' of the base table via 
the sequence (FACEIDSEQ) in the body of the trigger, but I can't seem 
to get the syntax right in order for the trigger to compile or run.  If 
someone could point out the problem with my approach (or code) --- it 
would be much appreciated.  

JS


#-------SQL follows ---------------

CREATE SEQUENCE FACEIDSEQ
START WITH  1
INCREMENT BY 1
NOMAXVALUE
CACHE 10;

CREATE TABLE FACES
     (
     FACEID                                                            
INTEGER  PRIMARY KEY,
     PICTUREID                                                         
INTEGER ,
     IMAGE_BLOB                                                        
LONG BYTE,
     FACEARRAY                                                         
LONG BYTE
     )
    ;
CREATE INDEX ixFACES_PICTUREID ON FACES (PICTUREID)  ;


CREATE  TRIGGER trigface FOR FACES 
    AFTER INSERT EXECUTE
    (
    BEGIN
       IF :NEW.FACEID IS NULL THEN
       SELECT FACES.FACEIDSEQ.NEXTVAL INTO :NEW.FACEID FROM DUAL;
    END;
    )


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to