急,在线等-->>存过怎么不能运行?
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;