在 Oracle 11g Express Edition 中运行 PL/SQL 代码 - 错误
Posted
技术标签:
【中文标题】在 Oracle 11g Express Edition 中运行 PL/SQL 代码 - 错误【英文标题】:Running PL/SQL code into Oracle 11g Express Edition - Error 【发布时间】:2012-01-09 21:06:56 【问题描述】:我正在尝试在 Oracle 11g XE 中运行以下 PL/SQL 代码。据我所知,代码没有任何问题,但是,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
任何帮助将不胜感激。
谢谢!
【问题讨论】:
不确定这是否有帮助。 ***.com/questions/3382833/… @Ben 当然除了表架构和数据 srikanthradix 不是真的,如果我没看错,我必须使用单引号,我已经这样做了 【参考方案1】:您提供的代码在我运行时非常适合我。但是,该错误表明您的变量名称和类型之间有一些额外的字符。即BOOKISBNƒƒƒƒƒƒƒƒBOOKTI
,所有f
字符从何而来?可能这些是错误处理程序正在转换为可打印字符的不可打印字符。如果您将以下内容复制并粘贴到您的变量声明中并再次尝试,会怎样?
bookIsbn BookTitle.Isbn%type;
bookName BookTitle.btName%type;
numOfCopies number;
【讨论】:
以上是关于在 Oracle 11g Express Edition 中运行 PL/SQL 代码 - 错误的主要内容,如果未能解决你的问题,请参考以下文章
在 Oracle 11g Express 中执行过程显示错误
在 Oracle 11g Express Edition 中运行 PL/SQL 代码 - 错误
Oracle Database 11g Express Edition 是啥