Joe Celko Function - Mailing list pgsql-general

From Ben-Nes Michael
Subject Joe Celko Function
Date
Msg-id 001d01c1f107$8ed0d3c0$aa0f5ac2@canaan.co.il
Whole thread Raw
Responses Re: Joe Celko Function
List pgsql-general
Hi All

Im trying to build set of function too handle nested tree structure, so I
used Joe Celco (SQL 4 Smarties).

I have some problem migrating one of his function to plpgsql function

This function suppose to close gaps relaying on some views.

I had two problems:
1. the while - how to migrate it
2. what is frammis ? some special variable in other db ? ( it just appeared
in this function and there is no mention to it in the chapter of nested tree
stracture ).


BEGIN
WHILE EXISTS ( SELECT * FROM gaps )
LOOP UPDATE frammis
SET rgt = CASE WHEN rgt > ( SELECT MIN(start) FROM gaps )
THEN rgt - 1 ELSE rgt END,
lft = CASE WHEN lft > ( SELECT MIN(start) FROM gaps )
THEN lft - 1 ELSE lft END;
END WHILE;

Cheer

--------------------------
Canaan Surfing Ltd.
Internet Service Providers
Ben-Nes Michael - Manager
Tel: 972-4-6991122
http://sites.canaan.co.il
--------------------------



pgsql-general by date:

Previous
From: pgsql-gen Newsgroup (@Basebeans.com)
Date:
Subject: Re: Failed compile on Sun
Next
From: Fran Fabrizio
Date:
Subject: Re: Joe Celko Function