| Author |
Topic |
|
mdfarhanasif
Starting Member
5 Posts |
Posted - 2009-12-14 : 03:25:08
|
| I hav a binary tree structure table in my database.All the time there is entry in my table from a form that insert each user into nodes of their parent.On each entry I hav to do some calculation after each entry. As this one is an online system there are multiple entry on each second in my table.while I was executing the calculation trigger on insert im getting error values in calculating the nodes.I think multiple triggering is creating this.I think I should provide a flag on each entry in the table.the trigger should read the flag and then process the calculation one by one.It should run all the time and search the flag value.then there will be no error.How I can create a trigger that run automatically all the time and whenever it finds any flag false it process the row????hope you guyz will understand the situation and advise me.Md. Farhan Asif |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-12-14 : 03:29:42
|
i think it will be much clearer for us to understand what you are doing if you can provide- table structure- the table trigger code- sample data- required result KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mdfarhanasif
Starting Member
5 Posts |
Posted - 2009-12-14 : 04:10:18
|
| actually this is a table that contains parent, left, right,serial,flag column.an insert proc inserts the values with flag false.the trigger i wrote works on this flag.its then counts nodes and calculate some information and update its parent stat. simple.the main thing is when i do multiple insert in different nodes of my tree structured form. when the trigger was processing the value when another entry comes then while the first trigger executes the second trigger fails to calculate the first triggers node.I need single trigger that checks the flag and process one by one.how??Md. Farhan Asif |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-12-14 : 04:19:38
|
does your trigger handling multiple records or only single record at a time ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mdfarhanasif
Starting Member
5 Posts |
Posted - 2009-12-14 : 04:26:26
|
| single rowMd. Farhan Asif |
 |
|
|
mdfarhanasif
Starting Member
5 Posts |
Posted - 2009-12-14 : 04:28:55
|
| but it actually uses the whole table and updates value on another tableMd. Farhan Asif |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-12-14 : 04:51:04
|
quote: Originally posted by mdfarhanasif single rowMd. Farhan Asif
that's the problem. You should not assume inserted and deleted table only contain one line. Change your trigger code and treat the inserted & deleted as a table that contains multiple records and it should be fine KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mdfarhanasif
Starting Member
5 Posts |
Posted - 2009-12-14 : 05:10:06
|
| bro, im not good at trigger. It will be great if you give me some detailsMd. Farhan Asif |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-12-14 : 05:18:43
|
post your trigger code here and we will take a look at it KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|