读书人

大神 帮忙见见执行存储过程的时候为什

发布时间: 2013-08-01 15:23:18 作者: rapoo

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

读书人网 >oracle

热点推荐