MySQL Forums
Forum List  »  Triggers

Creating a trigger to search in another table...
Posted by: Rick Langley
Date: February 28, 2006 09:17PM

Hey peoples,

This is a quick query about using a MySQL trigger to do the following:
Sorry about the lack of details, but i haven't got many myself.


Once a new record is inserted into table DATATABLE, the trigger is activated.
The trigger then uses data in a couple of the new records fields, which comes up with two numerical variables VAR1 and VAR2.
The two variables are then used to search through a table GRIDTABLE, which gives a final name TEXTVALUE which is then added to the record, which is then inserted.



Examples:
During Record 1 Insert ---> Outputs 110.5 and 35.9 ---> Searchs in GRIDTABLE for the closest lower value to these 110 and 35 ---> GRIDTABLE give them the output of "Toilet Paper" ---> Record 1 is finally inserted, with "Toilet Paper" in final field.

During Record 2 Insert ---> Outputs 110.0 and 36.1 ---> Searchs in GRIDTABLE for the closest lower value to these 110 and 36 ---> GRIDTABLE give them the output of "Washing Powder" ---> Record 2 is finally inserted, with "Washing Powder" in final field.


Thanks for any help at all,

If you need any more details on this problem post them here.

Options: ReplyQuote


Subject
Views
Written By
Posted
Creating a trigger to search in another table...
3166
February 28, 2006 09:17PM


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.