当前位置: 代码迷 >> Oracle管理 >> 急>>存过如何不能运行
  详细解决方案

急>>存过如何不能运行

热度:24   发布时间:2016-04-24 05:30:57.0
急,在线等-->>存过怎么不能运行?
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;
  相关解决方案