以下是我写的脚本:
create or replace procedure p_login ( NO IN number, PASS IN nvarchar2, out_code OUT number, out_desc OUT nvarchar2)
is
count1 number(10);
vcount number(10);
other EXCEPTION;
begin
select ID into count1 from EMP where EMPNO= NO;
select ID into vcount from EMP where EMPPASS= PASS and EMP.ID = count1;
if (count1 is not null and vcount is not null) then
out_code:=0;
out_desc:= '登录成功';
elsif (count1 is Null and vcount is Null) then
out_code:=1;
out_desc:= 'EMPNO不存在';
elsif (count1 is not Null and vcount is Null) then
out_code:=2;
out_desc:= '密码错误';
else out_code:=3;
out_desc:= '其他错误';
end if;
dbms_output.put_line(out_code||out_desc);
end p_login;