17,086
社区成员
发帖
与我相关
我的任务
分享
--根据上级编号获得分类设置树
create function [dbo].[fBWA_Lookup_Config_GetChildrenByParentID]
(
@Lcg_Parent_ID uniqueidentifier
)returns @t table(
[Lcg_ID] [uniqueidentifier],
[Lcg_System_Type] [tinyint],
[Lcg_Sub_System_Type] [tinyint],
[Lcg_Parent_ID] [uniqueidentifier],
[Lcg_Code] [varchar](100),
[Lcg_Name] [nvarchar](50),
[Lcg_Value] [nvarchar](100),
[Lcg_Order_No] [smallint],
[Lcg_Is_Default_Selected] [tinyint],
[Lcg_Description] [nvarchar](200),
[Lcg_Status] [tinyint],
[Lcg_Creater] [nvarchar](50),
[Lcg_Create_Time] [datetime],
[Lcg_Last_Modifier] [nvarchar](50),
[Lcg_Last_Modify_Time] [datetime]
,[Level] int
)
as
begin
return
end
先创建返回类型
create or replace type obj_table as object
(
id int,
name varchar2(50)
)
然后创建函数
create or replace function f_pipe(s number)
return t_table pipelined
as
v_obj_table obj_table;
begin
for i in 1..s loop
v_obj_table := obj_table(i,to_char(i*i));
pipe row(v_obj_table);
end loop;
return;
end f_pipe;