CREATE TRIGGER を作成しましたが、何らかの理由で、コンパイラ エラーが発生しないようにすることはできません。何か案は?コードとエラーメッセージは次のとおりです。
CREATE OR REPLACE TRIGGER ManagerDeleteTrigger
AFTER DELETE ON employee1
REFERENCING
OLD AS OldRow
NEW AS NewRow
FOR EACH ROW
WHEN(OldRow.FK_EMPLOYEEEMPLOYEEID != NewRow.FK_EMPLOYEEEMPLOYEEID)
UPDATE employee1 SET FK_EMPLOYEEEMPLOYEEID = null WHERE FK_EMPLOYEEEMPLOYEEID = OldRow.employeeID;
エラーメッセージは次のとおりです。
Error(1,105): PLS-00103: Encountered the symbol ";" when expecting one of the following:
( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable>
<< continue close current delete fetch lock insert open rollback savepoint set sql execute
commit forall merge pipe purge The symbol "exit" was substituted for ";" to continue.
編集:これが私の問題の明確化です。次のステートメントでテーブルを作成しています。各従業員にはマネージャー (FK で表される) がいます。
CREATE TABLE Employee1
(
employeeID integer,
firstName varchar (255),
lastName varchar (255),
phone integer,
jobTitle varchar (255),
payGrade integer,
fk_EmployeeemployeeID integer NOT NULL,
PRIMARY KEY(employeeID),
FOREIGN KEY(fk_EmployeeemployeeID) REFERENCES Employee1 (employeeID)
);
次に、従業員 A が自分の仕事のタイトルを変更するたびに、A を上司として持つすべての従業員を検索し、manager フィールドを null に設定するトリガーを作成したいと考えています。これは意味がありますか?