« Return to Thread: Problem creating a Trigger

Re: Problem creating a Trigger

by anniyan :: Rate this Message:

Reply to Author | View in Thread

Hi,
Thank you so much for the prompt response. Those comments were good to be kept in mind always.
I actually realised the mistake I was making as soon as I posted the problem here. So I managed the solve the problem.
However I have another problem which I need your ideas.
I have a table where prices for a few stock tickers are inserted. I have another temp table which holds the prices for the max trade date. I have a trigger which updates the temp table when there is a an insert into the main prices table. This makes sure that I have the latest data for all the tickers in the temp table.

Now I have a column called pricechange. I would like to calculate the difference between pevious close price and today's close price in that column. So theoretically speaking after the insert of new prices in the prices table and I would like a trigger that will update the pricechange with the price difference.
But I am unable to do it.

DBD::mysql::st execute failed: Can't update table 'tbl_prices' in stored functio
n/trigger because it is already used by statement which invoked this stored func

pls advice

 « Return to Thread: Problem creating a Trigger