RE:Re: AW: check NEW in insert trigger
"Anhaus, Thomas" <[email protected]> Tue, 9 Sep 2003 07:31:58 +0200
| Newsgroups | gmane.comp.db.sapdb.general |
|---|---|
| Message-ID | <[email protected]> |
Walter Link wrote : >Hallo Gerd, >you are right, the syntax of routines in SAP DB seems to be quite irregular >and is definitely not that what is described in the manual. >e.g. the following code has been rejected with an error message: >create trigger testTrigger1 for myTable after insert execute >( > if new.Name = 'invalid' then > stop (-30, 'invalid name'); >) This statement fails due to the keyword NEW in the if-statement. NEW/OLD make sense in update triggers only. In insert triggers NEW is assumed implicitly and must not be specified explicitly. >but this one works: >create trigger testTrigger1 for myTable after insert execute >( > var myname varchar(20); > set myname = new.Name; > if myname = 'invalid' then > stop (-30, 'invalid name'); >) >May be an if statement is not allowed at the beginning of a routine. For me, >that sounds very strange, but i have no other explanation. And that is not >the only strange thing i found within the SAP DB procedure language. I didn't >try to explore it systematically, but generally i think you shouldn't try to >use triggers in the current version of SAP DB if it is not absolutely >necessary. I am very interested in the other strange thinks you found. Maybe you remember some details ? Thomas -- Thomas Anhaus SAP DB, SAP Labs Berlin [email protected] http://www.sapdb.org/ _______________________________________________ sapdb.general mailing list [email protected] http://listserv.sap.com/mailman/listinfo/sapdb.general