编译时PL / Sql问题

时间:2018-02-09 23:11:21

标签: plsql oracle11g toad

显然我需要第二眼,因为对于我的生活,我看不出问题是什么。我创建了一个“测试”包来测试我的包代码,并且我不断收到包含在包中的“无效SQL”或“子程序或游标”错误。这让我很生气...这是我的代码,简单的东西真的...包声明符合正常,包体给我错误。无论我放在包体顶部的任何函数都会编译,另外2个不会,并且给我一个上面描述的2个错误。我最初在包含超过10,000行代码的另一个包中有这个,但是我创建了这个测试包,因为我在编译它时得到了各种奇怪的错误消息,所以我把它拿出来并且该包编译并运行正常。我使用Toad v10.0.0.41访问数据库,而不是Sql * Plus,多年来一直使用Toad。

包装:

CREATE OR REPLACE PACKAGE SomeSchema.TestPackage AS

FUNCTION PrimaryContactFullName (pPrimaryContact IN Varchar2, pFatherName IN Varchar2, pMothername IN Varchar2) RETURN VARCHAR2;

FUNCTION PrimaryContactFirstName(pPrimaryContact IN Varchar2, pFatherFirstName IN Varchar2, pMotherFirstname IN Varchar2) RETURN VARCHAR2;

FUNCTION PrimaryContactLastName(pPrimaryContact IN Varchar2, pFatherLastName IN Varchar2, pMotherLastname IN Varchar2) RETURN VARCHAR2;

END TestPackage;
/

包裹体:

CREATE OR REPLACE PACKAGE BODY SomeSchema.TestPackage IS
    FUNCTION PrimaryContactFirstName(pPrimaryContact IN Varchar2, pFatherFirstName IN Varchar2, pMotherFirstName IN Varchar2) RETURN VARCHAR2 IS
        W_FullName Varchar2(100);
    BEGIN
            IF Upper(pPrimaryContact) = 'MOTHER' Then
                W_FullName :=  pMotherFirstName;
            ELSIF Upper(pPrimaryContact) = 'FATHER' Then
                W_FullName :=  pFatherFirstName;
            ELSE
                W_FullName :=  pMotherFirstName;
            END IF;
            RETURN W_FullName;
        END;
    END;
    FUNCTION PrimaryContactLastName(pPrimaryContact IN Varchar2, pFatherLastName IN Varchar2, pMotherLastname IN Varchar2) RETURN VARCHAR2 IS
            W_FullName Varchar2(100);
    BEGIN
            IF Upper(pPrimaryContact) = 'MOTHER' Then
                W_FullName :=  pMotherLastName;
            ELSIF Upper(pPrimaryContact) = 'FATHER' Then
                W_FullName :=  pFatherLastName;
            ELSE
                W_FullName :=  pMotherLastName;
            END IF;
            RETURN W_FullName;
   END;
    FUNCTION PrimaryContactFullName(pPrimaryContact IN Varchar2, pFatherName IN Varchar2, pMothername IN Varchar2) RETURN VARCHAR2 IS
       W_FullName Varchar2(100);
    BEGIN
            IF Upper(pPrimaryContact) = 'MOTHER' Then
                W_FullName :=  pMotherName;
            ELSIF Upper(pPrimaryContact) = 'FATHER' Then
                W_FullName :=  pFatherName;
            ELSE
                W_FullName :=  pMotherName;
           END IF;
            RETURN W_FullName;
        END;
    END;
/

1 个答案:

答案 0 :(得分:0)

您的END;函数的结尾与PrimaryContactFirstName函数的开头之间有一个额外的PrimaryContactLastName声明。