日期:2014-05-17  浏览次数:20621 次

大神 帮忙看看执行存储过程的时候为什么报对象无效
create or replace procedure xh_procedure_1(x_sex in userinfo.sex%type) as
  x_count number;
begin
  if x_sex = 'M' then
    select count(*) into x_count from userinfo where sex = 'M';
    dbms_output.put_line(x_count);
  else
    x_sex = 'F' then
      select count(*) into x_count from userinfo where sex = 'F';
    dbms_output.put_line(x_count);
  end if;
end xh_procedure_1;

begin 
xh_procedure_1('M');
end;

对象xh_procedure_1无效
存储

------解决方案--------------------
  if x_sex = 'M' then
    select count(*) into x_count from userinfo where sex = 'M';
    dbms_output.put_line(x_count);
  elsif
    x_sex = 'F' then
      select count(*) into x_count from userinfo where sex = 'F';
    dbms_output.put_line(x_count);

另外为什么不用where sex=x_sex