Ravi Kora wrote :
>Hi,
>I am getting a serious problem when executing the trigger. I have a
>simple table like this
>CREATE TABLE "TESTUSER"."UNITS"
>(
> "UNITSINDEX" Integer DEFAULT SERIAL (1),
"NAME" Varchar (20) ASCII,
"UNITTYPE" Varchar (4) ASCII NOT NULL,
"RECORDTIME" Timestamp DEFAULT TIMESTAMP,
"DELETEFLAG" Boolean DEFAULT FALSE,
PRIMARY KEY ("UNITSINDEX")
>)
>I have a trigger for the above table like this
>CREATE TRIGGER timeupd FOR units AFTER UPDATE EXECUTE
>(update TESTUSER.UNITS set recordtime=timestamp where
>unitsindex=:OLD.unitsindex;)
>But when I execute an update statement on this table, I ma getting the
>following error message
>E -25009: Failure in db communication (receive): 1 = connection
>broken
>The above is happening for the database(SAPDB Version 7.3.0.23) running
>on Linux server.
>Strangely, I am able to execute all this without errors on the database
>installed on local machine(windows 2000 professional,SAPDB Version
>7.3.0.24).Can someone help me with this?
it seems that your trigger contains an endless recursion, because
the update trigger executes an update on the same table again,
which fires the trigger again and so on.
This endless recursion will crash the database under linux due to
stack overflow. Under windows the stack overflow is detected and
produces an error, which does not appear because there is
no error handling inside your trigger code.
Please change the trigger as follows :
CREATE TRIGGER timeupd FOR units AFTER UPDATE EXECUTE
(update TESTUSER.UNITS set recordtime=timestamp where
unitsindex=:OLD.unitsindex ignore trigger;
if $rc <> 0 then stop ($rc, $errmsg);
)
Best Regards,
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