CREATE OR REPLACE PROCEDURE ABC ( REG_NO IN CO_ENROLMENT.S_REGNO%TYPE,
TERM IN COURSEOFFERING.CO_TERMNUMBER%TYPE,
YEAR IN COURSEOFFERING.CO_YEAR%TYPE,
CO_TITLE IN COURSE.C_TITLE%TYPE,
EN_DATE OUT CO_ENROLMENT.COE_ENROLDATE%TYPE,
COM_ST OUT CO_ENROLMENT.COE_COMPLETIONSTATUS%TYPE)
AS
BEGIN
SELECT M.COE_COMPLETIONSTATUS, M.COE_ENROLDATE
INTO COM_ST, EN_DATE
FROM COURSEOFFERING O
INNER JOIN COURSE C
ON C.C_ID = O.C_ID
INNER JOIN CO_ENROLMENT M
ON M.CO_ID = O.CO_ID
WHERE M.S_REGNO LIKE REG_NO AND
O.CO_TERMNUMBER LIKE TERM AND
O.CO_YEAR LIKE YEAR AND
C.C_TITLE LIKE CO_TITLE;
END ABC;
我已经写下了上面的程序。下面是调用上述程序的 PL/SQL 块,
DECLARE
COMPL_STATUS CO_ENROLMENT.COE_COMPLETIONSTATUS%TYPE;
ENROL_DATE CO_ENROLMENT.COE_ENROLDATE%TYPE;
BEGIN
ABC (44444444, 2009, 2, 'PLSQL Programming',
EN_DATE => enrol_date, COM_ST =>compl_status);
DBMS_OUTPUT.PUT_LINE ('STUDENT COMPLETION STATUS AND ENROLMENT DATE IS '
|| ENROL_DATE
|| ' '
|| compl_status );
END;
由于找不到数据,它返回错误,但是当我单独运行查询时,我得到了输出。我无法弄清楚出了什么问题。我是否正确编写了程序块并且在 PL/SQL 块中传递的参数是否正确?