MySQL Forums
Forum List  »  Triggers

TRIGGER BEFORE INSERT - ALTER ADD column form insert value
Posted by: Mihai Grososiu
Date: May 28, 2008 08:48AM

Hello,
I'm stuck with this problem:
Before insert on user_types table, I have to create a column in user_rights table and the column name be the `type` inserted value (user_types.type).

DELIMITER $$;
DROP TRIGGER `new_type`$$
CREATE TRIGGER `new_type` BEFORE INSERT on `user_types`
FOR EACH ROW BEGIN
ALTER TABLE `user_rights` ADD NEW.type BINARY( 9 ) NULL;
END$$
DELIMITER ;$$

I've tried with trigger and I receive this error:
Explicit or implicit commit is not allowed in stored function or trigger.

Options: ReplyQuote


Subject
Views
Written By
Posted
TRIGGER BEFORE INSERT - ALTER ADD column form insert value
9268
May 28, 2008 08:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.