Article View: borland.public.interbase.sql
Article #805Return Value from Depth of recursive SP
From: navah
Date: Thu, 10 May 2007 09:36
Date: Thu, 10 May 2007 09:36
70 lines
2192 bytes
2192 bytes
i have two table TREE-struct and Data-table
TREE-struct have struct of my tree
Data Table show value of mystuct. the data-table on filed tree-link have
foreign key to tree-struct-id
i need have sum of value of tree from sub to root ans need result level by
level wih any depth of tree-struct
TREE-struct
==========================
id parent
1 -1
2 1
3 1
7 3
8 3
9 2
10 2
11 3
Data-Table
==========================
id tree-link value
1 9 5
2 10 7
3 7 20
4 10 5
5 11 50
6 7 15
|9
|-2-|10
1-|
| |-7
|-3-|-8
|-11
in up eaxmple Result Table must Return the same as below :
SP_TREE-result
==========================
id parent sum
1 -1 97
2 1 17
3 1 80
7 6 35
8 6 0
9 5 5
10 5 12
11 6 50
is not hard by use recursive stored procedure .
but one big prolem : can not recursive procedure in depth return value to
user (is true)?
useing new table for write result to this not nice beacuse my table db is
multi user
what waty to do it ?
Technical Details
Message-ID:
<4642e77a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,66ef50251936fb21,start X-Google-Attributes: gid114a0e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "navah" <mnavahan@yahoo.com> Newsgroups: borland.public.interbase.sql Subject: Return Value from Depth of recursive SP Date: Thu, 10 May 2007 13:06:20 +0330 Lines: 72 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 80.191.119.182 Message-ID: <4642e77a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1178789754 80.191.119.182 (10 May 2007 02:35:54 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail