【问题标题】:Encountered the symbol "="遇到符号“=”
【发布时间】:2013-10-04 16:22:42
【问题描述】:

使用以下 PL/SQL 时出现错误:

 1  DECLARE
      2   var_salary number(6);
      3   var_emp_id number(6) =7788;
      4  BEGIN
      5   SELECT sal
      6   INTO var_salary
      7   FROM emp
      8   WHERE emp.empno =var_emp_id;
      9  dbms_output.put_line(var_salary);
     10* end;


SQL> /
 var_emp_id number(6) =7788;
                      *
ERROR at line 3:
ORA-06550: line 3, column 23:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= ; not null default character
The symbol ":= was inserted before "=" to continue.

我是初学者,不知道为什么会出错

【问题讨论】:

  • 你得到一个明确的错误,告诉你把冒号 : 符号放在等于 = 符号的前面,用于分配一个该字段的值。

标签: oracle plsql syntax-error


【解决方案1】:

在第 3 行中使用赋值运算符 (:=) 代替相等运算符 (=)

【讨论】:

    【解决方案2】:

    = 是一个相等运算符,但您在赋值中使用它。赋值运算符是:=

    变化:

    var_emp_id number(6) =7788;
    

    var_emp_id number(6) := 7788;
    

    值得注意的是,您收到的错误消息为您提供了一些关于问题所在的提示;它告诉你行和列,然后你的操作符不正确:

    在“=”之前插入符号“:=”以继续。

    【讨论】:

      猜你喜欢
      • 2015-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-26
      • 2018-01-23
      • 2016-11-05
      • 1970-01-01
      相关资源
      最近更新 更多