SQL Server×Ö·û´®·Ö¸î
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
@str varchar(1024), --Òª·Ö¸îµÄ×Ö·û´®
@split varchar(10) --·Ö¸ô·ûºÅ
)
returns int
as
begin
declare @location int
declare @start int
declare @length int
set @str=ltrim(rtrim(@str))
set @location=charindex(@split,@str)
set @length=1
while @location<>0
begin
set @start=@location+1
set @location=charindex(@split,@str,@start)
set @length=@length+1
end
return @length
end
µ÷ÓÃʾÀý£ºselect dbo.Get_StrArrayLength('78,1,2,3',',')
·µ»ØÖµ£º4
¶þ¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóÖ¸¶¨Ë÷ÒýµÄµÚ¼¸¸öÔªËØ£¬ÏóÊý×éÒ»Ñù·½±ã
CREATE function Get_StrArrayStrOfIndex
(
@str varchar(1024), --Òª·Ö¸îµÄ×Ö·û´®
@split varchar(10), --·Ö¸ô·ûºÅ
@index int --È¡µÚ¼¸¸öÔªËØ
)
returns varchar(1024)
as
begin
declare @location int
declare @start int
declare @next int
declare @seed int
set @str=ltrim(rtrim(@str))
set @start=1
set @next=1
set @seed=len(@split)
set @location=charindex(@split,@str)
while @location<>0 and @index>@next
begin
set @start=@location+@seed
set @location=charindex(@split,@str,@start)
set @next=@next+1
end
if @
Ïà¹ØÎĵµ£º
SQL_Plus²Ù×÷ÃüÁî ¸½Â¼B SQL*PLUS
SQL*PLUS ÊÇOracleÌṩµÄÒ»¸ö¹¤¾ß³ÌÐò£¬Ëü²»½ö¿ÉÒÔÓÃÓÚ²âÊÔ£¬ÔËÐÐSQLÓï¾äºÍPL/SQL¿é£¬¶øÇÒ»¹¿ÉÒÔÓÃÓÚ¹ÜÀíOracleÊý¾Ý¿â
1.Æô¶¯sql*plus
ΪÁËʹÓÃsql*plus£¬±ØÐëÊ×ÏÈÒªÆô¶¯sql*plus¡£Oracle²»½öÌṩÁËÃüÁîÐкÍͼÐνçÃæµÄsql*plus£¬¶øÇÒ»¹¿ÉÒÔÔÚwebä¯ÀÀÆ÷ÖÐÔËÐÐ.
  ......
Ò»¡¢PL/SQL±à³Ì¹æ·¶Ö®´óСд
¾ÍÏñÔÚSQLÖÐÒ»Ñù£¬PL / SQLÖÐÊDz»Çø·Ö´óСдµÄ¡£ÆäÒ»°ã×¼ÔòÈçÏ£º
¹Ø¼ü×Ö(BEGIN, EXCEPTION, END, IF THEN ELSE,LOOP, END LOOP)¡¢Êý¾ÝÀàÐÍ(VARCHAR2, NUMBER)¡¢ÄÚ²¿º¯Êý(LEAST, SUBSTR)ºÍÓû§¶¨ÒåµÄ×Ó³ÌÐò(procedures, functions,packages)£¬Ê¹Óôóд¡£
±äÁ¿ÃûÒÔ¼°SQLÖеÄÁÐÃûºÍ±íÃû£¬Ê¹ÓÃÐ ......
ORACLEÖÐ×ֶεÄÊý¾ÝÀàÐÍ
×Ö·ûÐÍ char ·¶Î§ ×î´ó2000¸ö×Ö½Ú ¶¨³¤
char(10) 'ÕÅÈý' ºóÌí¿Õ¸ñ6¸ö°Ñ10¸ö×Ö½Ú²¹Âú 'ÕÅÈý &nb ......
Ê×ÏÈ´´½¨²âÊÔ±í¡¢Ìí¼ÓÊý¾Ý¡£
create table #t(a int,b int,c int,d int,e int)
insert into #t values(1,2,3,4,5)
insert into #t values(1,2,3,4,6)
insert into #t values(1,2,3,4,7)
insert into #t values(1,2,3 ......
ÔÚ´æ´¢¹ý³ÌÖÐʹÓÃÊÂÎñ£¬ÒÔÏÂΪģ°å£º
CREATE PROCEDURE testPro
AS
/**//* ------- ÊÂÎñ¿ªÊ¼---------- */
BEGIN TRANSACTION tran_test
/**//* -------- ±£´æÊÂÎñ----------*/
SAVE TRANSACTION tran_test
/**//* -------- Êý¾Ý²Ù×÷---------*/
INSERT [table1] ( [content] ) VALUES ( '43332' )
/**//*---- ......