oracle pl/sql输入错误

oracle pl/sql输入错误,oracle,plsql,oracle10g,Oracle,Plsql,Oracle10g,代码: DECLARE N NUMBER :=&N; BEGIN DBMS_OUTPUT.PUT_LINE(N); END; SET serveroutput ON SET define OFF DECLARE N NUMBER :=&N; BEGIN DBMS_OUTPUT.PUT_LINE(N); END; / Error starting at line : 8 in command - DECLARE N NUMBER :=&N; BEGIN

代码:

DECLARE
 N NUMBER :=&N;
BEGIN
 DBMS_OUTPUT.PUT_LINE(N);
END;
SET serveroutput ON
SET define OFF
DECLARE
  N NUMBER :=&N;
BEGIN
  DBMS_OUTPUT.PUT_LINE(N);
END;
/

Error starting at line : 8 in command -
DECLARE
  N NUMBER :=&N;
BEGIN
  DBMS_OUTPUT.PUT_LINE(N);
END;
Error report -
ORA-06550: line 2, column 14:
PLS-00103: Encountered the symbol "&" when expecting one of the following:

   ( - + case mod new not null <an identifier>
   <a double-quoted delimited-identifier> <a bind variable>
   continue avg count current exists max min prior sql stddev
   sum variance execute forall merge time timestamp interval
   date <a string literal with character set specification>
   <a number> <a single-quoted SQL string> pipe
   <an alternatively-quoted string literal with character set specification>
   <an alternatively
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:
错误:

DECLARE
 N NUMBER :=&N;
BEGIN
 DBMS_OUTPUT.PUT_LINE(N);
END;
SET serveroutput ON
SET define OFF
DECLARE
  N NUMBER :=&N;
BEGIN
  DBMS_OUTPUT.PUT_LINE(N);
END;
/

Error starting at line : 8 in command -
DECLARE
  N NUMBER :=&N;
BEGIN
  DBMS_OUTPUT.PUT_LINE(N);
END;
Error report -
ORA-06550: line 2, column 14:
PLS-00103: Encountered the symbol "&" when expecting one of the following:

   ( - + case mod new not null <an identifier>
   <a double-quoted delimited-identifier> <a bind variable>
   continue avg count current exists max min prior sql stddev
   sum variance execute forall merge time timestamp interval
   date <a string literal with character set specification>
   <a number> <a single-quoted SQL string> pipe
   <an alternatively-quoted string literal with character set specification>
   <an alternatively
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:
ORA-06550:第2行第12列:PLS-00103:遇到符号“&” 当预期出现以下情况之一时:

(+case mod new not null continue avg count current) 存在执行所有合并之前的最大最小sql STDEV和方差 时间戳间隔日期管道 您需要执行以下操作:

SET DEFINE ON
我认为您使用的是类似于sqldeveloper的GUI客户机,并且您没有define on。
&
用于替换变量

在SQL开发者中:

DECLARE
 N NUMBER :=&N;
BEGIN
 DBMS_OUTPUT.PUT_LINE(N);
END;
SET serveroutput ON
SET define OFF
DECLARE
  N NUMBER :=&N;
BEGIN
  DBMS_OUTPUT.PUT_LINE(N);
END;
/

Error starting at line : 8 in command -
DECLARE
  N NUMBER :=&N;
BEGIN
  DBMS_OUTPUT.PUT_LINE(N);
END;
Error report -
ORA-06550: line 2, column 14:
PLS-00103: Encountered the symbol "&" when expecting one of the following:

   ( - + case mod new not null <an identifier>
   <a double-quoted delimited-identifier> <a bind variable>
   continue avg count current exists max min prior sql stddev
   sum variance execute forall merge time timestamp interval
   date <a string literal with character set specification>
   <a number> <a single-quoted SQL string> pipe
   <an alternatively-quoted string literal with character set specification>
   <an alternatively
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

我可以知道您正在使用的IDE吗?oracle 10g sql命令您是否尝试在上设置定义;它在sql developer中成功工作,但在oracle 10g“sql命令”中不工作。它表示缺少或无效选项。我无法正确定义它,但它在浏览器中运行哪个10g express edition及其“sql命令”指定在何处执行sql查询。您必须告诉我们您正在做什么。您使用的是哪台客户端?至少,告诉我们您是否了解该客户端?oracle 10g express edition和我使用sql命令编写命令,这些命令在浏览器(firefox、chrome等)中打开。