Joe Celko Function

From: "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Joe Celko Function
Date: 2002-05-01 11:58:50
Message-ID: 001d01c1f107$8ed0d3c0$aa0f5ac2@canaan.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
--------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fran Fabrizio 2002-05-01 13:17:20 Re: Joe Celko Function
Previous Message pgsql-gen Newsgroup (@Basebeans.com) 2002-05-01 11:25:01 Re: Failed compile on Sun