Sql 要在select语句中使用该函数吗
我创建了一个函数,用于返回组织的VPHR:-Sql 要在select语句中使用该函数吗,sql,plsql,oracle-sqldeveloper,Sql,Plsql,Oracle Sqldeveloper,我创建了一个函数,用于返回组织的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是组织id,p_spoc是VPHR,p_DAT
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是组织id,p_spoc是VPHR,p_DATE是truncsysdate,
p_字符串为“员工编号”
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_SPOCP_ORG_ID IN NUMBER
,P_SPOC位于VARCHAR2
,P_DATE IN DATE
,VARCHAR2中的P_字符串,这样我在上面得到的组织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”声明太多
655300000-请-%s:%s
*原因:
*措施:首先,按照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;
因此,要对从上述选择中获得的组织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;
婴儿步。如果从dual中选择函数,会发生什么情况?此错误意味着您的XX_HR_GENERAL_包装中有多个函数,名为XX_GET_SPOC。请编辑您的问题,以包含包标题中所有此类函数的声明。