0

我正在尝试使用 select into 将值存储到变量中,但我不断收到此错误。有什么想法/建议吗?

错误

PLS-00103: Encountered the symbol "WHERE" when expecting one of the following:
    ( begin case declare end exit for goto if loop mod null
    pragma raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    continue close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe purge

程序

BEGIN
  FOR backup_cursor_rec IN backup_cursor
  LOOP

  select
       SUM(HIST.AMOUNT) into current_balance
        FROM
          AUTHZ_SPENDING_BALANCE_HISTORY HIST
        WHERE
          HIST.BALANCE_ID = backup_cursor_rec.BALANCE_ID
        GROUP BY
          HIST.BALANCE_ID; 

dbms_output.put('current balance is ' || current_balance
  || ' for '|| backup_cursor_rec.BALANCE_ID);

    UPDATE
      authz_spending_balance
    SET
      balance = current_balance      
    WHERE
      BALANCE_ID = backup_cursor_rec.BALANCE_ID ;

dbms_output.put('Updated');

    UPDATE
      google_backup_data temp
    SET
      temp.row_updated = 'Y', temp.HISTORY_AMOUNT = current_balance;
    WHERE
      temp.run_id       = run_id
    AND temp.BALANCE_ID = backup_cursor_rec.BALANCE_ID;

dbms_output.put('Backup updated');

    COMMIT;

  END LOOP;
END;
4

1 回答 1

2

你必须删除“;” current_balance 附近,来自第二个 UPDATE 语句

UPDATE
  google_backup_data temp
SET
  temp.row_updated = 'Y', temp.HISTORY_AMOUNT = current_balance
WHERE
  temp.run_id       = run_id
AND temp.BALANCE_ID = backup_cursor_rec.BALANCE_ID;
于 2013-09-19T23:01:28.040 回答