当我尝试在提示“请输入区域:”时输入用户输入时,我收到错误“PLS-00201:必须声明标识符'CHICAGO'”,例如如果我输入“CHICAGO”(当然不带引号) ) 我收到 PLS-00201 错误。我不知道为什么-有什么想法吗?提前致谢。
ACCEPT p_1 PROMPT 'PLEASE ENTER THE REGION:'
DECLARE
V_CHILD REGIONS.CHILD_NAME%TYPE := &p_1;
V_PARENT REGIONS.PARENT_NAME%TYPE;
CURSOR REG_CUR (p_child_name varchar2) IS
SELECT UPPER(CHILD_NAME)
FROM REGIONS
where CHILD_NAME = p_child_name;
BEGIN
OPEN REG_CUR (V_CHILD);
FETCH reg_cur INTO V_CHILD;
WHILE REG_CUR%FOUND LOOP
DBMS_OUTPUT.PUT_LINE(V_CHILD);
FETCH reg_cur INTO V_CHILD;
END LOOP;
CLOSE REG_CUR;
END;