我遇到了试图编译函数的错误。
PLS-00204:函数或伪列'EXISTS'可以在SQL中使用 仅声明
这是功能。
create or replace function get_ulq (
i_vcust_cd IN VARCHAR2,
i_vordr_type IN VARCHAR2,
i_vpart_no IN VARCHAR2
) RETURN VARCHAR2
AS
ulq_count varchar2(50 char) := null;
BEGIN
CASE WHEN exists ( SELECT count(*)
FROM P1.p7ulqpm0
WHERE cust_cd = i_vcust_cd
AND src = i_vordr_type
AND part_no = i_vpart_no)
then select ulq
into ulq_count
from p1.p2partm0
where src = i_vordr_type
and part_no = i_vpart_no;
ELSE ulq_count := 1;
END CASE;
RETURN ulq_count;
END get_ulq;