I am trying to create a trigger with a ClearDB that I have from Heroku, as far as I understand ClearDb is MySQL
, I have worked well with it so far that I want to do an insert after insert trigger, I am using it SQLPro
as an interface.
this is my query
CREATE TRIGGER usercount
AFTER INSERT
ON users_ FOR EACH ROW
BEGIN
DECLARE vUser varchar(50);
-- Find username of person performing the INSERT into table
SELECT USER() INTO Users_;
-- Insert record into audit table
INSERT INTO userscount_
( contact_id)
VALUES
( NEW.id_user
);
END;
And this what gives me back
MySQL said: Can't create a TRIGGER from within another stored routine
I think you're trying to insert this query into the "Definition" field, try putting just this:
I have also changed Users_ to vUser.