处理重载包抛出“无法解析对象详细信息”

时间:2012-04-13 01:13:41

标签: oracle oracle10g package packages

我正在处理一个重载包,并想知道两件事。

1)有没有办法获得更多关于发生了什么错误的信息,例如它发生的行号,因为Failed to resolve object details接缝有点模糊。

2)这句话似乎有什么问题?

   CREATE OR REPLACE PACKAGE shop_query_pkg IS
     procedure shop_info 
      (p_id IN bb_shopper.idshopper%TYPE,
       p_firstname out bb_shopper.firstname%TYPE);
      procedure shop_info 
      (p_id IN bb_shopper.lastname%TYPE,
       p_firstname out bb_shopper.firstname%TYPE);
    END;
    /
    CREATE OR REPLACE PACKAGE BODY show_query_pkg IS
     procedure shop_info 
      (p_id IN bb_shopper.idshopper%TYPE,
       p_firstname out bb_shopper.firstname%TYPE);
      IS
     BEGIN
       SELECT firstname
        into p_firstname
        FROM bb_shopper
        WHERE idshopper = p_id;
     EXCEPTION
      WHEN NO_DATA_FOUND THEN
       DBMS_OUTPUT.PUT_LINE('ID does not exist');
     END;
     -- second procedure
     procedure shop_info 
      (p_id IN bb_shopper.lastname%TYPE,
       p_firstname out bb_shopper.firstname%TYPE);
      IS
     BEGIN
       SELECT firstname
        into p_firstname
        FROM bb_shopper
        WHERE lastname = p_id;
     EXCEPTION
      WHEN NO_DATA_FOUND THEN
       DBMS_OUTPUT.PUT_LINE('Last name does not exist');
     END;
    END;
    /
    show errors;

错误

PACKAGE shop_query_pkg compiled
PACKAGE BODY show_query_pkg compiled
Warning: execution completed with warning
Failed to resolve object details 

3 个答案:

答案 0 :(得分:0)

您不能在重载过程中使用相同名称和相同数量的相同类型的参数 并且包体名称也是错误的 还有其他小错误

另外的第一和第二个程序 参数p_firstname类型p_firstname out bb_shopper.firstname%TYPE和bb_shopper.firstname%TYPE都是字符类型(EITHER BOTH CHAR或BOTH VARCHAR2等) 因此不算作不同的类型

请使用以下

CREATE OR REPLACE PACKAGE shop_query_pkg IS
      procedure shop_info(p_id1        IN bb_shopper.idshopper%TYPE,
                  p_firstname1 out bb_shopper.firstname%TYPE);
      procedure shop_info(p_id2        IN bb_shopper.lastname%TYPE,
                  p_firstname2 out bb_shopper.firstname%TYPE);
END;
/
CREATE OR REPLACE PACKAGE BODY shop_query_pkg IS
    procedure shop_info(p_id1 IN bb_shopper.idshopper%TYPE, 
                                  p_firstname1 out bb_shopper.firstname%TYPE)
               IS
        BEGIN
            SELECT firstname into p_firstname1 FROM bb_shopper WHERE idshopper = p_id1;
        EXCEPTION
        WHEN NO_DATA_FOUND 
        THEN 
            DBMS_OUTPUT.PUT_LINE('ID does not exist');
        END; -- second procedure      
    procedure shop_info(p_id2 IN bb_shopper.lastname%TYPE, 
                                  p_firstname2 out bb_shopper.firstname%TYPE)
               IS
        BEGIN
            SELECT firstname into p_firstname2 FROM bb_shopper WHERE lastname = p_id2;
        EXCEPTION
        WHEN NO_DATA_FOUND 
        THEN 
            DBMS_OUTPUT.PUT_LINE('Last name does not exist');
        END;
END;
/
show errors;

答案 1 :(得分:0)

在APPS的不同架构中创建一个包,不要在APPS中创建同义词。

如果程序包在编译时出现错误,如果您尝试使用'显示错误'来查看错误消息。它将显示消息为“无法解析对象详细信息”#39;因为APPS模式中没有包或同义词。

答案 2 :(得分:0)

检查您尝试编译的包的包规范是否有效。我建议你再次编译包规范,然后编译包体。这解决了我的问题。