Page is a not externally linkable
shmamy - 3:26 am on Dec 15, 2012 (gmt 0)
CREATE TABLE CHANGES
(USER CHAR(20) NOT NULL,
CHA_TIME TIMESTAMP NOT NULL,
CHA_ISBN CHAR(20) NOT NULL,
CHA_TYPE CHAR(1) NOT NULL,
CHA_ISBN_NEW CHAR(20),
PRIMARY KEY(USER, CHA_TIME, CHA_ISBN, CHA_TYPE))
CREATE TRIGGER INSERT BOOK_INFO
AFTER
INSERT ON BOOK_INFO FOR EACH ROW
BEGIN
INSERT INTO CHANGES
(USER, CHA_TIME, CHA_ISBN, CHA_TYPE, CHA_ISBN_NEW)
VALUES(USER, CURDATE(), NEW.ISBN, 'I', NULL);
END
syntax error: unexpected end
My book says to put the ';' in but when I do I get an unexpected end. When I don't put it I get this:
Error Code: 1064. 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 'INSERT BOOK_INFO AFTER INSERT ON BOOK_INFO FOR EACH ROW BEGIN INSERT INTO' at line 1
I'm stuck and can't figure out where my error is.