home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / sybase / 716 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.0 KB  |  46 lines

  1. Newsgroups: comp.databases.sybase
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!welchgate.welch.jhu.edu!oscar.welch.jhu.edu!ken
  3. From: ken@oscar.welch.jhu.edu (Ken Fasman)
  4. Subject: Re: Recursive Triggers ?
  5. Message-ID: <1993Jan22.025650.26799@welchgate.welch.jhu.edu>
  6. Followup-To: comp.databases.sybase
  7. Summary: No, sorry
  8. Keywords: triggers
  9. Sender: Ken Fasman
  10. Nntp-Posting-Host: oscar.welch.jhu.edu
  11. Organization: Genome Data Base, Johns Hopkins University
  12. References: <1jh22bINNmhn@meaddata.meaddata.com>
  13. Date: Fri, 22 Jan 1993 02:56:50 GMT
  14. Lines: 30
  15.  
  16. In article <1jh22bINNmhn@meaddata.meaddata.com> hth@meaddata.com (Hirendra Hindocha) writes:
  17. >I have a hierarchical database structure.  What I wanted to do was - 
  18. >an insert,update or a delete in a table should fire off a trigger which 
  19. >would perform some calculations for the hierarchy above the inserted one.
  20. >i.e a change affecting a child should start off a trigger , which would
  21. >then update the parent in the same table.  Now since this is again an
  22. >update, this should again start off the trigger to update the parent's 
  23. >parent and so on , till it reaches the top of the tree.
  24. >
  25. >Is it possible to do this ?  If it is , please let me know how ?
  26. >I tried a trigger , but that seems to be updating , only one level up.
  27. >It does not propagate all the way up the hierarchy as I expected.  
  28.  
  29. Sybase triggers cannot accomodate recursive operations, since they will not 
  30. fire more than once on the same insert/update/delete.  You must figure out 
  31. a way to accomplish the same task programmatically in one pass of the 
  32. trigger.
  33.  
  34. Triggers on one table can cause triggers on other tables to fire, if the 
  35. nested triggers configuration variable is set to 1.  They can also invoke 
  36. stored procedures.  The total number of trigger and stored procedure calls 
  37. on the stack (the "nesting level") must not exceed 16.
  38.  
  39. Ken Fasman,
  40. Genome Data Base
  41. Johns Hopkins University School of Medicine
  42. 2024 E. Monument St.
  43. Baltimore MD  21205
  44.  
  45. ken@library.welch.jhu.edu
  46.