我无法理解为什么会收到此错误。我有表,但代码示例不能正常工作。这里的问题是什么?
DECLARE
CURSOR c_cust(p_city VARCHAR2) IS
SELECT * FROM cust WHERE cust.city=p_city;
v_cust c_cust%ROWTYPE;
v_city c_cust%TYPE;
BEGIN
v_city := 'London';
OPEN c_cust (v_city);
LOOP
FETCH c_cust INTO v_cust;
EXIT WHEN (c_cust%NOTFOUND);
DBMS_OUTPUT.PUT_LINE (v_cust.cname || ' has ' || v_cust.rating);
END LOOP;
IF (c_cust%ISOPEN) THEN CLOSE c_cust;
END;
ORA-06550:第15行,第4栏:PLS-00103: 遇到符号";" 期待以下之一:if
- DECLARE
- CURSOR c_cust(p_city VARCHAR2)IS
- SELECT * FROM cust WHERE cust.city = p_city; **
醇>
答案 0 :(得分:1)
c_cust%ISOPEN
应该在结束循环之前;
If .... then
....
end if;
如果你错过了结局;