CREATE PROCEDURE SS.SP_PARENTSELECTLIST ( IN P_MENUID INTEGER,IN P_TYPEFLAG VARCHAR(30))
DYNAMIC RESULT SETS 1
------------------------------------------------------------------------
-- SQL 存储过程
-- selfId 自身的ID
------------------------------------------------------------------------
P1: BEGIN
-- 声明游标
DECLARE LIST CURSOR WITH RETURN FOR
with temptable(rowid,lastupdateuserDr,menuDr,name,conditionalexpression,caption,image,linkurl,leafflag,sequence,
shortcutkey,type,showinnewwindow,style,javascriptfile,javascriptfunction,valueexpression,
chart,chartbook,tree,component,target,lastupdatedate,lastupdatetime,javaclass,javamethod,validbean) as
(
select menu.ROWID as rowid,menu.LASTUPDATEUSER_DR as lastupdateuserDr,menu.MENU_DR as menuDr,
menu.NAME as name,menu.CONDITIONALEXPRESSION as conditionalexpression,menu.CAPTION as caption,
menu.IMAGE as image,menu.LINKURL as linkurl,menu.LEAFFLAG as leafflag,menu.SEQUENCE as sequence,
menu.SHORTCUTKEY as shortcutkey,menu.TYPE as type,menu.SHOWINNEWWINDOW as showinnewwindow,
menu.STYLE as style,menu.JAVASCRIPTFILE as javascriptfile,menu.JAVASCRIPTFUNCTION as javascriptfunction,menu.VALUEEXPRESSION as valueexpression,
menu.CHART as chart,menu.CHARTBOOK as chartbook,menu.TREE as tree,menu.COMPONENT as component,
menu.TARGET as target,menu.LASTUPDATEDATE as lastupdatedate,menu.LASTUPDATETIME as lastupdatetime,
menu.JAVACLASS as javaclass,menu.JAVAMETHOD asjavamethod ,
menu.VALIDBEAN as validbean
from SS.T_MENU menu
where rowid=P_MENUID
union all
select sub.ROWID as rowid,sub.LASTUPDATEUSER_DR as lastupdateuserDr,sub.MENU_DR as menuDr,
sub.NAME as name,sub.CONDITIONALEXPRESSION as conditionalexpression,sub.CAPTION as caption,
sub.IMAGE as image,sub.LINKURL as linkurl,sub.LEAFFLAG as leafflag,sub.SEQUENCE as sequence,
sub.SHORTCUTKEY as shortcutkey,sub.TYPE as type,sub.SHOWINNEWWINDOW as showinnewwindow,
sub.STYLE as style,sub.JAVASCRIPTFILE as javascriptfile,sub.JAVASCRIPTFUNCTION as javascriptfunction,sub.VALUEEXPRESSION as valueexpression,
sub.CHART as chart,sub.CHARTBOOK as chartbook,sub.TREE as tree,sub.COMPONENT as component,
sub.TARGET as target,sub.LASTUPDATEDATE as lastupdatedate,sub.LASTUPDATETIME as lastupdatetime,
sub.JAVACLASS as javaclass,sub.JAVAMETHOD asjavamethod ,
sub.VALIDBEAN as validbean
from SS.T_MENU sub,temptable super
where super.rowid=sub.MENU_DR
)
select * from T_MENU where TYPE=P_TYPEFLAG and rowid not in (select rowid from temptable);
-- 游标对客户机应用程序保持打开
OPEN list;
END P1