?
http://blog.itpub.net/519536/viewspace-571504
1.编写。编写一个最最简单的存储过程,给它起个名字叫做proc_helloworld
CREATE OR REPLACE PROCEDURE proc_helloworld
IS
BEGIN
?? DBMS_OUTPUT.put_line ('Hello World!');
END;
/
2.创建。在sqlplus命令行界面创建该存储过程
sys@ora10g> conn sec/sec
Connected.
sec@ora10g> CREATE OR REPLACE PROCEDURE proc_helloworld
? 2? IS
? 3? BEGIN
? 4???? DBMS_OUTPUT.put_line ('Hello World!');
? 5? END;
? 6? /
Procedure created.
3.运行。两种方法运行存储过程
1).需要在屏幕上显示出"DBMS_OUTPUT.put_line"的输出字符串,需要做一个小小的设置
sec@ora10g> show serveroutput
serveroutput OFF
sec@ora10g> set serveroutput on
sec@ora10g> show serveroutput
serveroutput ON SIZE 10000 FORMAT WORD_WRAPPED
2).在sqlplus命令行界面使用"EXECUTE"命令(简写做"EXEC")执行
sec@ora10g> exec proc_helloworld
Hello World!
PL/SQL procedure successfully completed.
3).在一个无名PL/SQL块