我正在尝试将以下PL / SQL代码运行到Oracle 11g XE中。据我所知,代码没有任何问题,但Oracle会给我错误 - 我不知道如何解决。
declare
bookIsbn BookTitle.Isbn%type;
bookName BookTitle.btName%type;
numOfCopies number;
procedure getTotalLoans(
getbookIsbn in BookTitle.Isbn%type,
getbookName out BookTitle.btName%type,
getnumOfCopies out number) is
begin
SELECT BookTitle.btName, COUNT(BookCopy.isbn)
INTO getbookName, getnumOfCopies
FROM BookTitle, BookCopy, Loan
WHERE getBookIsbn = BookCopy.isbn
AND BookTitle.isbn = BookCopy.isbn
AND BookCopy.bcId = Loan.bcId
AND loan.dateback is null
GROUP BY BookTitle.btName, BookTitle.isbn;
end;
begin
--main block
getTotalLoans (4,bookName,numOfCopies);
dbms_output.put_line('Book Name' || bookName || ' Number of copies on loan: ' || numOfCopies);
end;
/
我收到以下错误:
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00114: identifier 'BOOKISBNƒƒƒƒƒƒƒƒBOOKTI' too long
ORA-06550: line 2, column 34:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national charact
ORA-06550: line 3, column 1:
PLS-00114: identifier 'BOOKNAMEƒƒƒƒƒƒƒƒBOOKTI' too long
ORA-06550: line 3, column 34:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national charact
ORA-06550: line 4, column 1:
PLS-00114: identifier 'NUMOFCOPIESƒƒƒƒƒƒƒƒNUM' too long
ORA-06550: line 4, column 34:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp
任何帮助都将不胜感激。
谢谢!
答案 0 :(得分:3)
当我运行它时,你给出的代码对我来说非常合适。但是,该错误表明您的变量名称和类型之间有一些额外的字符。也就是BOOKISBNƒƒƒƒƒƒƒƒBOOKTI
,所有f
字符来自哪里?可能是这些是错误处理程序转换为可打印字符的不可打印字符。如果您将以下内容复制并粘贴到变量声明上并再次尝试,该怎么办?
bookIsbn BookTitle.Isbn%type;
bookName BookTitle.btName%type;
numOfCopies number;