我已经投入创造了一个包有两个,如下图所示,不过我有测试包,看看它是否工作麻烦。 我想调用程序和测试它的工作原理与输入是1和1000任何人都可以提出检测的方式的Oracle APEX好吗? 我不知道如果我在生产包装内的正确的输出方式,如果我测试的代码是一个过程之外和打包工作正常。 在一分钟我只是想测试一下它的SQL命令。
包
CREATE OR REPLACE PACKAGE pl_work_allocation_pkg
IS
PROCEDURE pl_work_allocation_pp(lv_crime_id IN NUMBER,
lv_emp_no IN NUMBER,
lv_end_date OUT DATE,
lv_work_desc OUT VARCHAR,
lv_police_officer OUT NUMBER,
lv_work_days OUT NUMBER,
lv_status OUT VARCHAR);
FUNCTION GET_WORK_DAYS1(p_work_end_date IN DATE)
RETURN NUMBER;
FUNCTION OVERDUE_DAYS1(p_work_end_date IN DATE)
RETURN VARCHAR;
END;
包体
CREATE OR REPLACE PACKAGE BODY pl_work_allocation_pkg
IS
FUNCTION GET_WORK_DAYS1(p_work_end_date IN DATE) RETURN NUMBER
IS
lv_work_days NUMBER(5);
BEGIN
lv_work_days := ROUND(p_work_end_date - SYSDATE);
RETURN lv_work_days;
END get_work_days1;
FUNCTION OVERDUE_DAYS1(p_work_end_date IN DATE) RETURN VARCHAR
IS
lv_status VARCHAR(10);
lv_work_days NUMBER(5);
BEGIN
lv_work_days := ROUND(p_work_end_date - SYSDATE);
IF lv_work_days > 1
THEN lv_status := 'DUE';
ELSIF lv_work_days < 1
THEN lv_status := 'OVERDUE';
END IF;
RETURN lv_status;
END overdue_days1;
PROCEDURE pl_work_allocation_pp(lv_crime_id IN NUMBER,
lv_emp_no IN NUMBER,
lv_end_date OUT DATE,
lv_work_desc OUT VARCHAR,
lv_police_officer OUT NUMBER,
lv_work_days OUT NUMBER,
lv_status OUT VARCHAR)
IS
BEGIN
SELECT
work_desc,
lead_police_officer,
work_end_date
INTO lv_work_desc, lv_police_officer, lv_end_date
FROM pl_work_allocation
WHERE s_reported_crime_id = lv_crime_id
AND d_emp_id = lv_emp_no;
lv_work_days := GET_WORK_DAYS(lv_end_date);
lv_status := OVERDUE_DAYS(lv_end_date);
dbms_output.PUT_LINE(lv_emp_no || ' is ' || lv_status || ' on case no: ' ||
lv_crime_id || ' by ' || lv_work_days || '. Report to ' || lv_police_officer ||
' for ' || lv_work_desc || ' details');
END pl_work_allocation_pp;
END;