| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: object algebra
> And now please write a query that returns an aggregate age of all persons.
> In this schema with SQL, or with Neo's school science fair project.
// Psuedo code to calc age of all unique persons under selected node // Step thru unique descendant's of God
int ageTotal = 0;
int* pDesc_a[kMAX_TREE_DEPTH] = {pGod};
while (int i = T_Relatives(pDesc_a, kCREATURE, kUNIQUE)){
int* pThing = pDesc_a[i];
if (IsAncestorOf(pPersonCls, pThing)){
int* pAge = T_Property_get(pThing, pAgeCls);
if (pAge){
sAge = T_Symbol_get(pAge);
ageTotal = ageTotal + ConvertSymbolToInteger(sAge);
}
}
XDb1 has transitive closure.
For actual code to a related problem, see www.xdb1.com/Example/Ex075b.asp
Received on Wed Feb 25 2004 - 19:09:33 CST
![]() |
![]() |