折磨死人的 ORA-01422报错

create or replace function "F_BHM_HT_GETEMPID_BYLOG2"
(logname in VARCHAR2)
return  NUMBER
is
l_empid number;
--l_count number;
begin
select  a.id into l_empid from ESUN_EMP a where upper(a.logname)=upper(logname);
--select  count(a.id) into l_count from ESUN_EMP a where upper(a.logname)=upper(logname);
return l_empid;
exception when no_data_found then return 0;

end;

报错返回值超出请求行数,实际肯定只有一行,原因是函数的参数是Oracle保留字!!!

将logname 改成logname1 就没问题了

你可能感兴趣的:(ORA-01422报错)