不懂ORACLE,求各位高手将下面的这段存储过程改为ORACLE的。在线求……各种求
create PROCEDURE ST_SLwrite
@slID int --仓库ID
with ENCRYPTION
AS
BEGIN
SET NOCOUNT ON;
SET DATEFIRST 1 --设置周一=1,周日=7
------------------------------------------------------------
--0-参数设置
declare
@rootID int,@plantid int,@managID int,@lockty int,
@partID int,@partID1 int
------------------------------------------------------------
DECLARE @CurrentError int
BEGIN TRANSACTION
------------------------------------------------------------
--1-初始化
set @partID=(select ParentID from CP_WAREHOUSE where ID=@slID)
------------------------------------------------------------
--2-过程程序体 (select DATEPART(weekday,@iDate))
-----step1:删除本期间原有周序设置
if @partID>0
begin
while @partID>0
begin
set @partID1=(select isnull(ParentID,0) from CP_WAREHOUSE where ID=@partID)
if @partID1=0
begin
set @rootID=@partID1
set @plantid=( --更节点的 营运部门
select btPlantID from CP_WAREHOUSE
where ID=@partID
)
set @managID=( --更节点的 id
select id from CP_WAREHOUSE
where ID=@partID
)
set @lockty=( --更节点的 锁定状态
select locktype from CP_WAREHOUSE
where ID=@partID
)
if @managID is not null and @managID>0
begin
if @lockty=1 or @lockty=2 --根节点锁定 和 封闭
update CP_WAREHOUSE
set btPlantID=@plantid,
SL_maID=@managID,
locktype=@lockty
where ID =@slID
else
update CP_WAREHOUSE
set btPlantID=@plantid,
SL_maID=@managID
where ID =@slID
end
end
set @partID=@partID1
end
end--if true
else
begin
if @slID is not null and @slID>0
update CP_WAREHOUSE
set SL_maID=@slID
where ID =@slID
end
------------------------------------------------
-- 错误处理
------------------------------------------------
select @CurrentError = @@Error
IF @CurrentError != 0
BEGIN
GOTO ERROR_HANDLER
END
--end of transaction
COMMIT TRANSACTION
-- Reset SET NOCOUNT to OFF
SET NOCOUNT OFF
-- return 0 to indicate success, otherwise the raised error will be returned
RETURN
ERROR_HANDLER:
ROLLBACK TRANSACTION
SET NOCOUNT OFF
RETURN @CurrentError
END
------解决方案--------------------
眼晕 = = ,友情帮顶。。
------解决方案--------------------
40分,少啦......
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html