4

尝试用一个过程创建简单的包:

CREATE OR REPLACE 
PACKAGE PACKAGE1 AS 

procedure procHTML1 is
begin
htp.print('
<html>
 <head>
  <title>PL/SQL Example Pages</title>
 </head>
<body>');
end procHTML1;

END PACKAGE1;

但我明白了

Error(5,3): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:     language 
Error(14,5): PLS-00103: Encountered the symbol "PACKAGE1" when expecting one of the following:     ; 

任何帮助将不胜感激

4

1 回答 1

13

包由包规范和包体组成。您在规范中声明该过程(假设您希望该过程是公共的)并在正文中实现它。

因此,例如,您将创建包规范

CREATE OR REPLACE PACKAGE package1
AS
  PROCEDURE procHTML1;
END package1;

然后你会创建包体

CREATE OR REPLACE PACKAGE BODY package1
AS
  PROCEDURE procHTML1
  AS
  BEGIN
    htp.print( '<<some HTML>>' );
  END procHTML1;
END package1;
于 2012-05-18T18:22:08.660 回答