Oracle错误PLS-00323:子程序或游标在程序包规范中声明,并且必须在程序包主体中定义 [英] Oracle Error PLS-00323: subprogram or cursor is declared in a package specification and must be defined in the package body
本文介绍了Oracle错误PLS-00323:子程序或游标在程序包规范中声明,并且必须在程序包主体中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我把我的pl/sql过程放在一个包中吗?我已经尝试过并且正在为此苦苦挣扎:
Can someone help me put my pl/sql procedure in a package? I've tried and I'm struggling with it:
这是我的包裹规格说明:
This is what I have, for my package specification:
CREATE OR REPLACE PACKAGE film_pkg
IS
title VARCHAR2(100);
PROCEDURE get_films(fname VARCHAR2);
END film_pkg;
--
这是我遇到问题的程序包主体
This is my package body where im running into the problems:
CREATE OR REPLACE PACKAGE BODY film_pkg
IS
PROCEDURE get_films (fname IN film.title%TYPE,
r_date OUT film.release_date%TYPE,
dur OUT film.duration%TYPE)
AS
BEGIN
SELECT release_date, duration
INTO r_date, dur
FROM FILM
WHERE title = fname;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
r_date := '';
dur := '';
END get_films;
END film_pkg;
如果有人可以帮助我修复错误,我将不胜感激:
if anyone could help me fix the errors i'd appreciate it:
Error(4,11): PLS-00323: subprogram or cursor 'GET_FILMS' is declared in a package specification and must be defined in the package body
推荐答案
您的标头和主体过程定义不匹配
Your header and body procedure definitions don't match
在标题中,您具有:
PROCEDURE get_films(fname VARCHAR2);
体内:
PROCEDURE get_films(fname IN film.title%type,
r_date OUT film.release_date%type, dur OUT film.duration%type)
您可能只需要使用另外两个OUT参数更新标头定义?
You probably just need to update the header definition with the two additional OUT params?
总结
- 确保标题定义与主体实现的所有参数匹配(参数数量,参数名称,参数顺序和参数类型)
- 根据Alex的评论,请勿将自定义类型(
film.title%type
)与基本类型(VARCHAR2
)混合并匹配.选择一个.
- Ensure the header definition matches all parameters of the body implementation (number of parameters, names of parameters, order of parameters, and the parameter types)
- As per Alex's comment, do not mix and match the custom type (
film.title%type
) with the base type (VARCHAR2
). Choose one or the other.
这篇关于Oracle错误PLS-00323:子程序或游标在程序包规范中声明,并且必须在程序包主体中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文