set ansi_nulls on
set quoted_identifier on
goalter procedure [dbo].[updatenews]
@newsid int,
@title nvarchar(100),
@content text,
@catids varchar(200),
@error nvarchar(200) output
asbegin
declare @index int
declare @catid varchar(10)
begin transaction
begin try
update newscontent set title=@title,[content]=@content
where id=@newsid
delete from newscategory where newsid=@newsid
--while迴圈
while(len(@catids)>0)
begin
set @index=charindex(':',@catids)
if(@index<>0)
begin
set @catid=substring(@catids,1,@index-1)
set @catids=substring(@catids,@index+1,len(@catids)-@index)
endelse
begin
set @catid=@catids
set @catids=''
endinsert into newscategory(newsid,catid) values(@newsid,cast(@catid as int))
end--迴圈結束
commit transaction
return 0
end try
begin catch
set @error=error_message()
rollback transaction
return -1
end catch
end
修改儲存過程
修改儲存過程 alter procedure owner procedure name procedure definition procedure definition 請參見create procedure 語句。alter procedure owner procedure name set ...
Mysql修改儲存過程
alter procedure 儲存過程名 特徵 指定了儲存過程的特性,可能的取值有 contains sql 表示子程式包含 sql 語句,但不包含讀或寫資料的語句。no sql 表示子程式中不包含 sql 語句。reads sql data 表示子程式中包含讀資料的語句。modifies sql...
根據內容查儲存過程
1.oracle中下面這麼寫 按名查詢儲存過程 select from user objects where object type procedure and object name like upper p 按內容查詢儲存過程 select from all source where type ...