1

DB2 コマンド行プロセッサーで次のタイプの複合ステートメントを実行しようとしています。

BEGIN ATOMIC
UPDATE schema.tablename set column1 = xyz where condition = somecondition;
UPDATE schema.tablename2 set column2 = abc where condition = somecondition
END

しかし、次のエラーが表示されます

BEGIN ATOMIC
UPDATE schema.tablename set column1 = xyz where condition = somecondition
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "where condition = somecondition". 
Expected tokens may include:  "<delim_semicolon>".  LINE 
NUMBER=2.  SQLSTATE=42601

UPDATE schema.tablename2 set column2 = abc where condition = somecondition END
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END" was found following "where condition = somecondition".  
Expected tokens may include:  "END-OF-STATEMENT".  SQLSTATE=42601

SQL0104N  An unexpected token "END" was found following "where condition = somecondition".  Expected tokens may include:  "END-OF-STATEMENT                             ".

これが db2 sql コマンド ライン プロセッサでサポートされているかどうかはわかりません。要件は、ストアド プロシージャではなく、アトミックな方法で 3 つのクエリを実行することです。他の代替案もあればご指導ください。

4

1 に答える 1