What is the error in the following code. I am executing in mysql
CREATE TRIGGER tg_order_insert
BEFORE INSERT
ON `order` FOR EACH ROW
BEGIN
INSERT INTO `grocery`.`order_seqid` VALUE(NULL);
SET NEW.order_id = CONCAT('#GNC', LPAD(LAST_INSERT_ID(),3,'0'));
END;
Grocery is the database and order_seqid and order are 2 table.
order_seqid is a table with only 1 attribute if type int and auto increment.
Am trying to put a prefix on the id which we insert into order table.
I am getting 2 errors in INSERT INTO.....
and END;
line
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…