2

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

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 
4

3 回答 3

0

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

此外,第一个和第二个过程的参数 p_firstname 类型 p_firstname out bb_shopper.firstname%TYPE 和 bb_shopper.firstname%TYPE 都是 Characters 类型(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;
于 2012-04-13T03:13:50.827 回答
0

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

于 2015-12-09T22:10:28.593 回答
0

在与 APPS 不同的架构中创建包,并且不要在 APPS 中创建同义词。

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

于 2015-07-30T08:56:33.170 回答