MySQL Forums
Forum List  »  Triggers

Creating Trigger.. New to this obviously
Posted by: Colin Haime
Date: March 14, 2019 08:32PM

I am trying to create a trigger to change a download link in my database.

The program I am using is creating a download link pointing to the wrong directory. After a new record is created I want to change the incorrect potion of the download URL to the correct one. I was hoping to create a trigger to do this.

I have written it as follows

CREATE TRIGGER Update_Directory AFTER INSERT ON wpin_gm_user_entries UPDATE wpin_gm_user_entries SET download_link = REPLACE(download_link, 'uploads', 'gravity2pdf') ;

If I run the update command manually as an sql command it works. If I run it as part of a Trigger it does not.

Am I attempting the impossible or is something else wrong?

Thanks in advance.

Options: ReplyQuote


Subject
Views
Written By
Posted
Creating Trigger.. New to this obviously
515
March 14, 2019 08:32PM


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.