In general hierarchical tables that is implemented with postgres on OpenACS has a tree_sortkey column. And you can use tree_* plsql.
Here is are samples:
http://cvs.openacs.org/cvs/*checkout*/openacs-4/contrib/packages/bcms/tcl/bcms-category-procs-postgresql.xql?rev=1.1
You may also want to look at Timo's categories as the cr_keywords is the older implementation and I know will be changed.