MySQL Forums
Forum List  »  Triggers

Re: Select with trigger
Posted by: Peter Brawley
Date: November 14, 2017 02:10PM

> I want create an after insert trigger which creates a table with at least 4 columns
> but only three are permanent column names, they don't change.

If you try to create a table in a Trigger, you'll get the error message "Explicit or implicit commit is not allowed in stored function or trigger."

There'd be something very fishy indeed about a database design that depends on Triggers defining tables.

> Do I create the table with the known columns names first,
> then do an alter for each value in the query result
> or is there a way of adding the new columns in the same alter query?

Why do you think there a need to add table columns?

Databases aren't like take-out orders. Except for temp utility tables, table structure should be the opposite of ad hoc, it should go through an exacting process of verified reconciliation with the database requirement.

Options: ReplyQuote


Subject
Views
Written By
Posted
716
November 14, 2017 01:23PM
Re: Select with trigger
269
November 14, 2017 02:10PM


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.