遇到符号“@”时

时间:2016-04-06 21:40:45

标签: oracle sequence

我正在尝试更新'company_code'表中'companies'的值,以便按照某种顺序更新。

我正在尝试使用它:

DECLARE 
@cmpcode INT
SET @cmpcode = 0 
UPDATE companies
SET @cmpcode = company_code = @cmpcode + 1 

它给了我这个错误:

Error starting at line : 16 in command -
DECLARE 
@cmpcode INT
SET @cmpcode = 0 
UPDATE companies
SET @cmpcode = company_code = @cmpcode + 1 
Error report -
ORA-06550: line 2, column 1:
PLS-00103: Encountered the symbol "@" when expecting one of the following:

   begin function pragma procedure subtype type <an identifier>
   <a double-quoted delimited-identifier> current cursor delete
   exists prior
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

我为询问某些事情而道歉,我确信这是一种愚蠢的语法疏忽。

谢谢。

1 个答案:

答案 0 :(得分:0)

也许这会有所帮助?

DECLARE cmpcode INT;
BEGIN 
  cmpcode := 0; 
  UPDATE companies 
  SET company_code = cmpcode + 1
  WHERE <your where expression>;
END  
;