当前位置: 代码迷 >> Sql Server >> sqlserver存储过程哪位高手能帮忙改为oracle
  详细解决方案

sqlserver存储过程哪位高手能帮忙改为oracle

热度:32   发布时间:2016-04-24 19:20:33.0
sqlserver存储过程谁能帮忙改为oracle
USE [etcom_v9]
GO
/****** Object:  StoredProcedure [dbo].[Web_Login]    Script Date: 01/07/2014 09:44:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/***
 * 网上营业厅登陆
***/
ALTER procedure [dbo].[Web_Login]
@vcUserName varchar(50), ---用户名
@vcPassword varchar(20),  ---密码
@vcCustType varchar(50) = '普通用户'    --登陆的用户类型
AS
Begin
Declare @vcPasswordCheck varchar(20)  --用户密码
Declare @vcCustNO        varchar(20)  --客户编码

if @vcCustType = '普通用户'
begin
select @vcCustNO = vcCustNO,@vcPasswordCheck = vcPsw from Boss_Custom a,BOSS_Associate b where a.vcCustNO=b.vcCustomNO and b.vcLink=@vcUserName
if @vcCustNO is null
begin
select @vcCustNO = vcTel,@vcPasswordCheck = vc170Psw from Jfgl_UserInfo where vcTel=@vcUserName
if @vcCustNO is null
select @vcCustNO = vcUserID,@vcPasswordCheck = vcPsw from BBN_UserInfo where vcUserID=@vcUserName
if @vcCustNO is null
select @vcCustNO = vcDoorNo,@vcPasswordCheck = vcPsw from DTV_UserInfo where vcDoorNo=@vcUserName
end
end
else if @vcCustType = '单位用户'
select @vcCustNO = a.vcCustNO,@vcPasswordCheck = a.vcPsw from BOSS_Custom a,jfgl_custinfo b where a.vcCustNO = b.vcAccNo and a.vcCustType = '单位用户' and b.vcDeptNo = @vcUserName

--验证密码是否正确
if @vcUserName is not null and @vcPassword is not null and @vcPassword=@vcPasswordCheck
Begin
select '1' as nRes,@vcCustNO as vcCustomNO
End
Else
Begin
select '-1' as nRes,'' as vcCustomNO
End
End

------解决方案--------------------
试试这个:

create procedure Web_Login
(vcUserName varchar2(50),
 vcPassword varchar2(20),
 vcCustType varchar2(50)='普通用户')
is
begin
vcPasswordCheck varchar2(20);
vcCustNO varchar2(20);

if vcCustType='普通用户' then
begin
 select vcCustNO into vcCustNO,
   vcPsw into vcPasswordCheck
 from Boss_Custom a
 inner join BOSS_Associate b on a.vcCustNO=b.vcCustomNO and b.vcLink=vcUserName
 
if vcCustNO is null then
begin
  select vcTel into vcCustNO,
vc170Psw into vcPasswordCheck
  from Jfgl_UserInfo 
  where vcTel=vcUserName

 if vcCustNO is null then
   select vcUserID into vcCustNO,
  vcPsw into vcPasswordCheck
from BBN_UserInfo 
where vcUserID=vcUserName
 end if;
    
 if vcCustNO is null then
   select vcDoorNo into vcCustNO,
  vcPsw into vcPasswordCheck
from DTV_UserInfo 
where vcDoorNo=@vcUserName
 end if;
   end if;
end;
else
begin
if vcCustType='单位用户' then
begin
 select a.vcCustNO into vcCustNO,
   a.vcPsw into vcPasswordCheck
 from BOSS_Custom a
 inner join jfgl_custinfo b on a.vcCustNO=b.vcAccNo and a.vcCustType='单位用户' and b.vcDeptNo=vcUserName
end;
end if;

if vcUserName is not null and vcPassword is not null and vcPassword=vcPasswordCheck then
Begin
select '1' "nRes",vcCustNO "vcCustomNO" from dual
End;
Else
Begin
select '-1' "nRes",'' "vcCustomNO" from dual
End;
end if;
end;


end;
  相关解决方案