USE [test] GO /****** Object: UserDefinedFunction [dbo].[tf_split_char] Script Date: 2019/7/8 14:39:15 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[tf_split_char] ( @cstring NVARCHAR(MAX), --被拆分的字符串 ) --分隔符 ) RETURNS…
1.创建表对象类型. 在Oracle中想要返回表对象,必须自定义一个表类型,如下所示: create or replace type t_table is table of number; 上面的类型定义好后,在function使用可用返回一列的表,如果需要多列的话,需要先定义一个对象类型.然后把对象类型替换上面语句中的number: 定义对象类型: create or replace type obj_table as object ( id int, name varchar2(50…
--字符串分割表函数 ) ) declare @i int; declare @count int; ); ); declare @Index int; )) declare @rowID int; set @str='aaa;bbb;ccc;d;'; set @split=';'; ; set @count=LEN(@str); set @ChildStr=@str; ; while @i<=@count begin set @Index= charindex(@split,@ChildStr…