--定义包头
create or replace package 包名
as
变量、常量声明;
函数声明;
过程声明;
end;
--定义包体
create or replace package body 包名
as
函数实际代码;
过程实际代码;
end;
create or replace package pkg_school
as
stucount int;
procedure prc_getstucount;
end;
create or replace package body pkg_school
as
procedure prc_getstucount
as
begin
select count(*)
into stucount
from t_student;
dbms_output.put_line('人数为:'||stucount);
end;
end;