Afficher un message
Vieux 06/09/2007, 15h34   #4
Martijn Tonies
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem creating a Trigger

Hi,

> However I have another problem which I need your ideas.


It's better to create a new thread when you want to discuss a new
problem.

> 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


Welcome to MySQLs half-assed trigger implementation ;-)

Can you do this from the first trigger that updates the temp table (inserts
the items?) instead?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

  Réponse avec citation
 
Page generated in 0,05849 seconds with 9 queries