I would to create a trigger for Sybase, but it shows an error.
What I want to do is, when a delete operation is done on the [student]
table, to check whether there is any record related to student on [account], and if so, raise an exception.
There seems to be a lack of support by Sybase. Their official seem not people to visit.
*CREATE TRIGGER AccountChecker
BEFORE DELETE ON student
REFERENCING OLD AS old_student
FOR EACH ROW
BEGIN
DECLARE @acc CHAR(4);
DECLARE @acc_not_null EXCEPTION FOR SQLSTATE '99999';
SELECT @acc=account.account_number FROM account
WHERE account.student_id = old_student.student_id;
IF @acc IS NOT NULL
BEGIN
SIGNAL acc_not_null
END
END*