Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nesting error in trigger
Message
De
10/06/2005 01:22:21
Eugene Kolmakov
Millennium Technologies
Vladivostok, Russie
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Nesting error in trigger
Divers
Thread ID:
01022038
Message ID:
01022038
Vues:
70
Hi!

I have a problem. When I change values of a record in the table, I need to update some other child records in the same table. And I want to make it work using trigger. But nesting error is raised on trigger execution. I use the following code:

FUNCTION Update_Child_Fields

IF myTable.Type = 1 && Type = 1 - Parent, Type = 2 - Child

lcParentID = ALLTRIM(myTable.Key)
lcOwnerID = ALLTRIM(myTable.OwnerID)
lcAliasName = SYS(2015)

USE myTable AGAIN IN 0 ALIAS (lcAliasName)

SELECT (lcAliasName)
Replace Parent_OwnerID WITH lcOwnerID;
FOR ALLTRIM(Parent) == lcParentID
IN (lcAliasName)

USE IN (lcAliasName)

ENDIF

ENDFUNC

I call this function in myTable's Update trigger. I have no idea why it doesn't work and how to make it work correctly. Need your help.

P.S. Now I removed all links to MyTable (i.e. Key instead of myTable.Key, etc.). Now it says: "Illegal recursion in rule evaluation". As far as I could understand, trigger can't be fired within itself.
But I need to make it work. How?
Eugene
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform