Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Extracting Parent Model from Nested Sets Model

Re: Extracting Parent Model from Nested Sets Model

From: Flavio Botelho <nuncanada_at_ig.com.br>
Date: 22 Jan 2003 10:00:17 -0800
Message-ID: <de0df942.0301221000.4efba471@posting.google.com>


nuncanada_at_ig.com.br (Flavio Botelho) wrote in message
> > I do not know MySQL, so I guessed at the translation to SQL Server:
> >
> > BEGIN
> > DECLARE @next_brother INTEGER;
> DECLARE @parent_left INTEGER;
> DECLARE @parent_right INTEGER;
> SET @parent_left = 7;
> SET @parent_right = 16;
>
> SET @next_brother = @parent_left+1;
>

I missed this, it should be:

SELECT @next_brother:=CASE WHEN lft >= @next_brother Instead of:
> > SELECT CASE WHEN lft >= @next_brother

Is this possible in other SQL dialects? To updated an user variable inside a SELECT?

> > THEN rgt+1
> > ELSE @next_brother END AS child,
> > part AS parent
> > FROM Frammis
>
> WHERE lft >= @parent_left AND rgt <= @parent_right
> HAVING child = rgt+1
>
>
> > ORDER BY lft;
> > END;
Regards,
Nuncanada Received on Wed Jan 22 2003 - 12:00:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US