create or replace procedure fyou(tid in varchar2)
is
t_name varchar2(10);
no varchar2(10);
begin
select count(c.name) into no from c  where c.part=tid;
if no=0 then
dbms_output.put_line(0);
else
select c.name into t_name from c where c.part=tid;
dbms_output.put_line('rrr');
end if;
exception
when no_data_found then
dbms_output.put_line('fyou');
end fyou;declare
td varchar2(10);
begin
td:='02';
fyou(td);
end;
c.part有02,可是结果显示为0

解决方案 »

  1.   

    1、select count(c.name) into no from c where c.part=tid; --如果没猜错,执行的话肯定是0。另c表中一定有tid这个字段,导致与传参混乱
      

  2.   

    把参数改个名字 i_tid
    目测,因为你的表中存在一个列交 tid 和参数同名了,oracle把where条件中tid当做 列名了。
      

  3.   


    C表没tid这个字段.那么为什么一定是0,我菜鸟不太懂
      

  4.   

    where trim(c.part) = tid
      

  5.   

    c表字段只有part,name,id没有tid,值里面也没有tid