我的存储过程出错了...对于如何解决它的想法?
程序如下:
CREATE OR REPLACE PROCEDURE prc_medic_check_status(v_task_id IN VARCHAR, v_request_id IN VARCHAR, v_task_desc IN VARCHAR, v_task_status IN VARCHAR) IS v_task_id task.task_id%TYPE;
v_request_id task.request_id%TYPE;
v_medical_id Varchar(30);
v_medical_status Varchar(30);
BEGIN
SELECT request_id INTO v_request_id
FROM Request
WHERE request_type = "Medical";
SELECT task_id INTO v_task_id
FROM task
WHERE request_id = v_request_id ;
SELECT medical_status INTO v_medical_status
FROM Medical m,
medicalRequest mr,
Request r
WHERE mr.request_id = r.request_id
AND mr.medical_id = m.medical_id;
IF (v_medical_status = "Available") THEN
UPDATE Task
SET task_status = "Done"`enter code here
WHERE request_id = v_request_id;
DBMS_OUTPUT.PUT_LINE('Medical Task Done');
ELSE DBMS_OUTPUT.PUT_LINE('Medical Task Not Done');
DBMS_OUTPUT.PUT_LINE('Due To The Medical Product Is Currently Not Available');
END IF;
END;
/
答案 0 :(得分:0)
您的参数变量被定义为存储过程中的局部变量,从而导致错误。通常,我们使用p_ *来传递参数,因此我强烈建议您按如下方式定义存储过程:
CREATE OR REPLACE PROCEDURE prc_medic_check_status(p_task_id IN VARCHAR, p_request_id IN VARCHAR, p_task_desc IN VARCHAR, p_task_status IN VARCHAR)
然后在查询中更改新参数名称:
SELECT task_id INTO v_task_id
FROM task
WHERE request_id = p_request_id ;