set pagesize 1000
set linesize 220
set trimspool on
set tab offset numwidth 10
procedure test01
as
begin
end test01;
procedure test02
as
begin
end test02;
execute test01;
execute test02;
set pagesize 1000
set linesize 220
set trimspool on
set tab offset numwidth 10
set serveroutput on
create procedure test01
as
begin
dbms_output.put_line('this is test01');
end test01;
/
create procedure test02
as
begin
dbms_output.put_line('this is test02');
end test02;
/
execute test01;
execute test02;
字符串 运行脚本:
koen 19c>@/tmp/script
Procedure TEST01 compiled
Procedure TEST02 compiled
this is test01
PL/SQL procedure successfully completed.
this is test02
PL/SQL procedure successfully completed.
set pagesize 1000
set linesize 220
set trimspool on
set tab offset numwidth 10
DECLARE
procedure test01
as
begin
DBMS_OUTPUT.PUT_LINE('test01');
end test01;
procedure test02
as
begin
DBMS_OUTPUT.PUT_LINE('test02');
end test02;
BEGIN
test01;
test02;
END;
/
CREATE PROCEDURE test01
as
begin
DBMS_OUTPUT.PUT_LINE('test01');
end test01;
/
CREATE PROCEDURE test02
as
begin
DBMS_OUTPUT.PUT_LINE('test02');
end test02;
/
型 然后只从脚本中调用该过程:
set pagesize 1000
set linesize 220
set trimspool on
set tab offset numwidth 10
set serveroutput on
execute test01;
execute test02;
2条答案
按热度按时间deyfvvtc1#
不知道这是不是你要找的,但这确实有效:
脚本内容:
字符串
运行脚本:
型
siv3szwd2#
如果你想定义一个非存储过程,那么在PL/SQL块的
DECLARE
部分定义它,并在PL/SQL块的BEGIN
部分调用它:字符串
其输出:
型
fiddle
如果你想定义一个存储过程,那么使用
CREATE PROCEDURE
来创建一次存储过程(在你的脚本之外):型
然后只从脚本中调用该过程:
型