Reputation: 1548
I want to create dynamic triggers in java. Before executing an insert/delete/update i will create the trigger with the correct data it needs to work on and after the insert/delete/update is finished i will drop the trigger.
Is it okay to drop and recreate triggers dynamically through the application? If so what is the risk?
Upvotes: 0
Views: 134
Reputation: 7147
You could create triggers dynamically but I don't know why you would. If your calling application is completely aware of what data needs to be manipulated, then why not just let your calling application make the database updates?
Triggers are when you ALWAYS want something to happen to your data, everytime that data is updated, inserted, or deleted. That's not what you want. You are just trying to run a statement once. Better to do that in your application.
Upvotes: 1