首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

大神 帮忙见见执行存储过程的时候为什么报对象无效

2013-08-01 
大神帮忙看看执行存储过程的时候为什么报对象无效create or replace procedure xh_procedure_1(x_sex in u

大神 帮忙看看执行存储过程的时候为什么报对象无效
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

热点排行