Re: Getting a grip on nested intervals and matrix encoding
Date: Mon, 5 Jul 2010 12:25:57 -0700 (PDT)
Message-ID: <8d217229-435c-4fe3-bf06-2731ad0c055c_at_x24g2000pro.googlegroups.com>
On Jul 3, 12:09 pm, creecode <creec..._at_gmail.com> wrote:
> On Jul 1, 2:05 pm, creecode <creec..._at_gmail.com> wrote:
>
> > I'm attempting to use Vadim Tropashko's nested intervals and matrix
> > encoding technique. As described in chapter 5 of his "SQL Design
> > Patterns" book and also in various online articles and discussion
> > groups.
>
> Hello again,
>
> I'm now onto the ancestors portion of the chapter starting on page 177
> and the formula for calculating ancestor matrices seems to work OK
> except for the the root node. Is the root node a special case that I
> should detect and then just insert it manually?
>
> Let's use our friend FORD from my MatrixTreeNodes table shown
> previously and run the formula.
>
> name materialized_path a11 a12 a21 a22
> FORD 1.1.2 7 3 5 2
>
> SELECT 3 AS a11, 3 - MOD ( 7, 3 ) AS a12, 2 AS a21, 2 - MOD ( 5, 2 )
> AS a22;
>
> a11 a12 a21 a22
> 3 2 2 1
>
> SELECT 2 AS a11, 2 - MOD ( 3, 2 ) AS a12, 1 AS a21, 1 - MOD ( 2, 1 )
> AS a22;
>
> a11 a12 a21 a22
> 2 1 1 1
>
> ** that isn't what we want **
>
> Toodle-loooooooo..........
> creecode
select MOD(2,1) from dual;
MOD(2,1)
0
Fire your database vendor:-) Received on Mon Jul 05 2010 - 21:25:57 CEST