1. PL/SQL Hello World.
create or replace procedure protest1
is
begin
loop
dbms_output.put_line('hello1:-)');
dbms_output.put_line('hello2:-)');
dbms_output.put_line('hello3:-)');
exit;
end loop;
end;
执行步骤:
(0)SQL>conn scott/tiger
(1)SQL>set serveroutput on;
(2)SQL> @/scratch/weiywang/study_space/scripts/sql/protest1.sql
(3)SQL>execute protest1
(4)查询已经创建的存储过程:
SQL>select object_name
from user_procedures;
2.存储过程的授权
存储过程作为一个数据库对象,其他用户必须拥有执行该过程的权限才可以使用它。
SQL>grant execute on protest1 to public;
SQL>conn guest/Welcome1
SQL>set serveroutput on
SQL>execute scott.protest1;