函数如下:create or replace function F_xsjc(t_customer_id varchar2)
return integer is p_num integer;
  p_num1 char(20);
  p_count integer;
  p_num2 char(20);
beginselect userdefinedstatus into p_num1 from (
 select rownum no,a.* from (select * from tabccontacthis_his 
  where  customer_id=t_customer_id order by createddate) a
)where no=1;
  
  select count(*) into p_count from tabccontacthis_his
  where customer_id=t_customer_id;select userdefinedstatus into p_num2 from (
 select rownum no,a.* from (select * from tabccontacthis_his 
  where  customer_id=t_customer_id order by createddate) a
)where no=p_count;if  p_num1-p_num2<0 then p_num:=1;
elsif  p_num1-p_num2=0 then p_num:=0;
elsif  p_num1-p_num2>0 then p_num:=-1;
end if;
    return p_num;
end F_xsjc;编译能过, select F_xsjc('C1B576FA47802ABCE044001A4B084A44') from dual也有数据
但是 select F_xsjc(customer_id) from tabccontacthis_his就跑不出数据报错:ORA-06512:F_xsjc line8