MySQL Forums
Forum List  »  Triggers

Create Trigger Syntax MYSQL V 5.5.8
Posted by: Mark McCutcheon
Date: April 20, 2011 08:26AM

Hi,

I have a database in version 5.5.8 with 6 tables as follows:

artists
exhibitions
exhibitions_items
for_sale
items
sold

I want to create a trigger such that, after insertion of an item into the items table, it is also inserted into the for_sale table.

I have tried to write some code within phpmyadmin along the lines of

CREATE OR REPLACE FUNCTION trigger
RETURNS SETOF ITEMS AS
$$
BEGIN
INSERT INTO for_sale('ID', 'Price') Values(select max id FROM items
Return TABLE(Select * From for_sale WHERE on INSERT));
END;

I believe however this is wrong as I am getting an error message.

Could anyone assist as I need to finish this urgently.

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Create Trigger Syntax MYSQL V 5.5.8
4208
April 20, 2011 08:26AM


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.