List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:September 6 2007 2:34pm
Subject:Re: Problem creating a Trigger
View as plain text  

> 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

> 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
> 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
> 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
My thoughts:
Database development questions? Check the forum!

Problem creating a Triggeranniyan6 Sep
  • Re: Problem creating a TriggerRolando Edwards \(DBA\)6 Sep
  • Re: Problem creating a Triggeranniyan6 Sep
  • Re: Problem creating a TriggerMartijn Tonies6 Sep