Thread: Hierarchical Queries

Hierarchical Queries

From
"Gautham S. Rao"
Date:
Hi,
 
Can someone tell me how to write a hierarchical query in pgsql. What I want is something like the '...CONNECT BY PRIOR ... START WITH....' clause which is available in Oracle.
 
Regards,
Gautham.
 

Re: Hierarchical Queries

From
Christopher Kings-Lynne
Date:
You can't - that syntax is not implemented in Postgres.

The only alternative is to try and write a stored procedure that uses a
FOR loop.  Remember that you can only return an open cursor from pl/pgsql,
not an actual recordset.

Chris

On Tue, 9 Apr 2002, Gautham S. Rao wrote:

> Hi,
>
> Can someone tell me how to write a hierarchical query in pgsql. What I
> want is something like the '...CONNECT BY PRIOR ... START WITH....'
> clause which is available in Oracle.
>
> Regards,
> Gautham.
>
>



Re: Hierarchical Queries

From
Roberto Mello
Date:
On Tue, Apr 09, 2002 at 06:34:29PM +0530, Gautham S. Rao wrote:
> Hi,
> 
> Can someone tell me how to write a hierarchical query in pgsql. What I want is something like the '...CONNECT BY
PRIOR... START WITH....' clause which is available in Oracle.
 

There have been lots of messages discussing this topic on this list.
Search the archives and take a look at the "Porting from Oracle PL/SQL"
chapter of the documentation.

-Roberto

-- 
+----| http://fslc.usu.edu/ USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net/      http://www.sdl.usu.edu/ - Space Dynamics Lab, Developer    
 
Ad astra, per ardua nostra.