我创建了一个返回组织VPHR的函数: -
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
现在我希望我使用此功能XX_HR_GENERAL_PKG.XX_GET_SPOC(P_ORG_ID IN NUMBER ,P_SPOC IN VARCHAR2 ,P_DATE IN DATE ,P_STRING IN VARCHAR2)这样的方式使得我在上面得到的organization_id可以在这个函数中使用,如下所示: -
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”
*原因:
*操作:
答案 0 :(得分:0)
首先,正如Luke所建议的,请为此功能发布您的规范。
其次,如下所示的第一个选择将列出所有那些不等于你在此选择中传递的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;