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

急>>存过如何不能运行

2012-03-23 
急,在线等--存过怎么不能运行?create or replace procedure test(x in number) isbeginif x 0 thenbeg

急,在线等-->>存过怎么不能运行?
create or replace procedure test(x in number) is
begin
  if x > 0 then
  begin
  x := 0 - x;
  dbms_output.put_line(x);
  end;
  end if;
  if x = 0 then
  begin
  x := 1;
  dbms_output.put_line(x);
  end;
  end if;
end test;

declare
  x integer ;
begin
  X := 3;
  test(X);
  dbms_output.put_line(x);
end;


[解决办法]
这两段代码不要放在一起执行,按这样操作:
1、新建sql窗口,执行如下代码,以创建存储过程test:
create or replace procedure test(x in out number) is
begin
if x > 0 then
begin
x := 0 - x;
dbms_output.put_line(x);
end;
end if;
if x = 0 then
begin
x := 1;
dbms_output.put_line(x);
end;
end if;
end test;

2、新建sql窗口,执行如下代码,查看输出:
declare
x integer ;
begin
X := 3;
test(X);
dbms_output.put_line(x);
end;

热点排行