cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcelo F. Ochoa" <moc...@ieee.org>
Subject Re: recursion & sql in xsp
Date Tue, 29 Aug 2000 21:39:48 GMT
Steve Conover wrote:

> Another problem:
>
> I have a generic category tree stored in a table, like this
>
> catgid  catgname        catgparentid
> 0               root            0
> 1               blue            0
> 2               red             0
> 3               orange  2
> 4               green           1
>
> Imagine there are 20+ levels in my hierarchy...I need to design something in
> xsp to start with a catgid, make a sql call, get that category's parentid,
> and feed it back to the same sql call until it reaches the root id (0).  All
> the while I need to construct some xml that reflects the hierarchy.
>
> Any ideas on how to do this?  Is it even possible?

  You could use this sql query:

   select catgid,catgname,level from table_name
      start with catgparentid = 0 connect by prior catgid=catgparentid;

  This query return all rows of the table and the pseudo column level, then
with the style sheet you could sort or filter the result.
  It isn't the best solution but ..., if don't agree with this, you could use
DB Prism and make an stored procedure that solve your constraint returning
directly the XML that you need.

>
>
> Regards,
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

  Regards, Marcelo.

Mime
View raw message