测试第一个Oracle存储过程

时间:2022-05-19 07:57:31

存储过程语句

//简单存储过程的例子
//每调用一次打印一次hello world
create or replace procedure sayhelloworld
as
begin
dbms_output.put_line('Hello world');
end;

sqlplus 下测试存储过程

Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。 C:\Users\wd>sqlplus SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 19 15:48:18 2017 Copyright (c) 1982, 2010, Oracle. All rights reserved. Enter user-name: system
Enter password: Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> set serveroutput on //打开屏幕输出开关 需要打印字符串
SQL> execute sayhelloworld();
Hello world PL/SQL procedure successfully completed. SQL>