0
CREATE TRIGGER Tr1
AFTER DELETE ON Table1
REFERENCING
    OLD TABLE AS OldTable,
    NEW TABLE AS NewTable
FOR EACH STATEMENT

次のエラーが発生します。

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that     corresponds to your MySQL server version for the right syntax to use near 'REFERENCING 
OLD TABLE AS OldTable,
NEW TABLE AS NewTable

どうしてこれなの?

4

1 に答える 1

0

古いテーブルを表示する場合は、BEFOREDELETEトリガーを作成する必要があります-

CREATE TRIGGER Tr1
  BEFORE DELETE
  ON Table1
  FOR EACH ROW
BEGIN
  ...
  SET @old_count = NULL;
  SELECT COUNT(*) INTO @old_count FROM Table1;
  ...
END
于 2012-11-26T07:23:26.193 に答える