写了一个oracle函数,在命令窗口运行时 编译错误。求大神指点 10
createorreplacefunctiongetNum(ainvarchar2(1))returnnumber;asout_numnumber(3);beginifa...
create or replace function getNum(a in varchar2(1))
return number;
as
out_num number(3);
begin
if a = 'P' then
select count(*) into out_num from
pm_off_info t where t.p_flag='P';
dbms_output.put_line('P产品品的数量是:'||out_num);
else
select count(*) into out_num from
pm_off_info t where t.p_flag='S';
dbms_output.put_line('S产品的数量是:'||out_num);
end if;
return out_num;
end getNum; 展开
return number;
as
out_num number(3);
begin
if a = 'P' then
select count(*) into out_num from
pm_off_info t where t.p_flag='P';
dbms_output.put_line('P产品品的数量是:'||out_num);
else
select count(*) into out_num from
pm_off_info t where t.p_flag='S';
dbms_output.put_line('S产品的数量是:'||out_num);
end if;
return out_num;
end getNum; 展开
1个回答
展开全部
create or replace function getNum(a in varchar2)
return number
is
begin
declare
out_num number(3);
begin
if a = 'P' then
select count(*) into out_num from
pm_off_info t where t.p_flag='P';
dbms_output.put_line('P产品品的数量是:'||out_num);
else
select count(*) into out_num from
pm_off_info t where t.p_flag='S';
dbms_output.put_line('S产品的数量是:'||out_num);
end if;
return out_num;
end ; end getNum;
return number
is
begin
declare
out_num number(3);
begin
if a = 'P' then
select count(*) into out_num from
pm_off_info t where t.p_flag='P';
dbms_output.put_line('P产品品的数量是:'||out_num);
else
select count(*) into out_num from
pm_off_info t where t.p_flag='S';
dbms_output.put_line('S产品的数量是:'||out_num);
end if;
return out_num;
end ; end getNum;
追问
没有用啊,加了declare 和 end 还是编译错误
Warning: Function created with compilation errors
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询