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


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

Reply via email to