postgresql7.1
select
content_keyword__is_leaf(:id) as is_leaf,
content_keyword__get_heading(:id) as heading,
content_keyword__get_description(:id) as description,
content_keyword__get_path(:id) as path
from
dual
select
keyword_id,
content_keyword__is_leaf(keyword_id) as is_leaf,
content_keyword__get_heading(keyword_id) as heading,
(select count(*) from cr_item_keyword_map m
where m.keyword_id = k.keyword_id) as item_count
from
cr_keywords k
where
$where_clause
order by
is_leaf, heading