2013-12-21 38 views
1

我創建了返回組織VPHR功能: -想用的功能在select語句

XX_HR_GENERAL_PKG.XX_GET_SPOC(P_ORG_ID IN NUMBER 
          ,P_SPOC IN VARCHAR2 
          ,P_DATE IN DATE 
          ,P_STRING IN VARCHAR2); 

哪裏p_org_id是的organization_ID,p_spoc是VPHR,P_DATE是TRUNC(SYSDATE), p_string是 'EMPLOYEE_NUMBER'

SELECT DISTINCT aou.name parent_org, 
      aou.organization_id organization_id, 
      level 
     FROM PER_ORG_STRUCTURE_ELEMENTS OSE, 
      HR_ALL_ORGANIZATION_UNITS AOU 
     where aou.organization_id   = ose.organization_id_child 
     and aou.organization_id  not in (:p_org_id) 
     start with organization_id_child = :p_org_id 
     connect by organization_id_child = prior organization_id_parent 
     order by level; 

輸出: -

Parent Org    Organization_id Level 
Serviced Portfolio PR 330   2 
PR Operations   106   3 

無無線要我在這樣一種方式,我在上面得到了的organization_ID可以在該功能有些像這樣使用使用該功能XX_HR_GENERAL_PKG.XX_GET_SPOC(P_ORG_ID IN NUMBER ,P_SPOC IN VARCHAR2 ,P_DATE IN DATE ,P_STRING IN VARCHAR2) : -

SELECT DISTINCT aou.name parent_org, 
       aou.organization_id organization_id, 
       level, 
       XX_HR_GENERAL_PKG.XX_GET_SPOC(:P_ORG_ID 
           ,'VPHR' 
           ,TRUNC(SYSDATE) 
           ,'emp_num'); 
      FROM PER_ORG_STRUCTURE_ELEMENTS OSE, 
       HR_ALL_ORGANIZATION_UNITS AOU 
      where aou.organization_id   = ose.organization_id_child 
      and aou.organization_id  not in (:p_org_id) 
      start with organization_id_child = :p_org_id 
      connect by organization_id_child = prior organization_id_parent 
      order by level; 

錯誤越來越:-ORa-06553:PLS-307: 'XX_GET_SPOC' 的聲明太多這個調用 06553. 00000匹配 - 「PLS-%S:%S」 *原因:
*行動:

+1

嬰兒學步。如果你從雙重選擇你的功能會發生什麼? –

+2

此錯誤意味着您的'XX_HR_GENERAL_PKG'打包的名爲'XX_GET_SPOC'中有多個函數。請編輯您的問題以包含您的軟件包標題中所有這些功能的聲明。 –

回答

0

首先,如盧克建議,請認真答覆您也可以發佈您的規格以獲取此功能。

其次,如下所示的第一個選擇將列出所有那些不等於您在此選擇中通過的id的組織。

 


SELECT DISTINCT aou.name parent_org, 
      aou.organization_id organization_id, 
       level 
     FROM PER_ORG_STRUCTURE_ELEMENTS OSE, 
      HR_ALL_ORGANIZATION_UNITS AOU 
     where aou.organization_id   = ose.organization_id_child 
     and aou.organization_id  not in (:p_org_id) 
     start with organization_id_child = :p_org_id 
     connect by organization_id_child = prior organization_id_parent 
     order by level; 

 

所以用你的功能從上述選擇中獲得的oraganization的ID,你需要修改你的第二個選擇,如下:

 


SELECT DISTINCT aou.name parent_org, 
       aou.organization_id organization_id, 
       level, 
     XX_HR_GENERAL_PKG.XX_GET_SPOC(aou.organization_id 
           ,'VPHR' 
           ,TRUNC(SYSDATE) 
           ,'emp_num'); 
      FROM PER_ORG_STRUCTURE_ELEMENTS OSE, 
       HR_ALL_ORGANIZATION_UNITS AOU 
      where aou.organization_id   = ose.organization_id_child 
      and aou.organization_id  not in (:p_org_id) 
      start with organization_id_child = :p_org_id 
      connect by organization_id_child = prior organization_id_parent 
      order by level;