【发布时间】:2012-02-07 07:51:29
【问题描述】:
我正在尝试在 Oracle 11g 上运行此代码,但它给了我以下错误。我好像没弄好。
DECLARE
CURSOR bookcursor IS
SELECT btName, BookCopy.Isbn, pubName, dateDestroyed
FROM booktitle bt
JOIN publisher p
ON bt.pubId = p.pubId
JOIN bookcopy bc
ON bt.Isbn = bc.Isbn
WHERE datedestroyed IS NULL
;
bookcursorrec bookcursor%ROWTYPE;
BEGIN
OPEN bookcursor;
LOOP
FETCH bookcursor INTO bookcursorrer;
EXIT WHEN bookcursor%NOTFOUND;
dbms_output.put_line( 'ISBN: ' ||bookcursorrec.isbn
|| ' - Book Name: ' || bookcursorrec.btname
|| ' - Publisher: ' || bookcursorrec.pubname );
END LOOP;
CLOSE bookcursor;
END;
ERROR at line 3:
ORA-06550: line 3, column 20:
PL/SQL: ORA-00904: "BOOKCOPY"."ISBN": invalid identifier
ORA-06550: line 3, column 5:
PL/SQL: SQL Statement ignored
ORA-06550: line 2, column 12:
PLS-00341: declaration of cursor 'BOOKCURSOR' is incomplete or malformed
ORA-06550: line 11, column 19:
PL/SQL: Item ignored
ORA-06550: line 15, column 31:
PLS-00201: identifier 'BOOKCURSORRER' must be declared
ORA-06550: line 15, column 9:
PL/SQL: SQL Statement ignored
ORA-06550: line 17, column 42:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 17, column 9:
PL/SQL: Statement ignored
你能指出我出了什么问题吗?我似乎无法理解哪里出了问题
谢谢, 布赖恩
【问题讨论】:
标签: sql oracle plsql cursor oracle11g