db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John English <john.fore...@gmail.com>
Subject Re: More trigger problems
Date Mon, 26 Aug 2013 14:04:48 GMT
On 25/08/2013 23:40, tim.wickett wrote:
> I still get the syntax error if i have the WHERE clause after the triggered
> statement.
> The idea of the code was to create a new entry in the
> WASTE_ITEM_LOCATION_HISTORY table every time the current_location value was
> updated in the WASTE_ITEM table. However I don't want an entry if any other
> value is updated. I want a history of each location an item of waste has
> been stored at.

OK, so your condition should be "OLD.current_location <> NEW.current_location".
However, INSERT statements don't have a WHERE clause either. Rick's suggestion 
to use a procedure to insert or not seems to be the only way to do what you want.

John English

View raw message