DB2 SQL错误:SQLCODE= -104,SQLSTATE=42601,SQLRRMC =*;开始选择;(,DRIVER=4,19.26

5ssjco0h  于 2023-04-30  发布在  DB2
关注(0)|答案(1)|浏览(367)

我对DB2比较陌生,但对SQL不熟悉。我在尝试SELECT语句时遇到以下错误

<validation>
   <validate-on-match>true</validate-on-match>
   <background-validation>true</background-validation>
   <background-validation-millis>60000</background-validation-millis>
   <check-valid-connection-sql>begin; select * from DBSCHEMA.DB_VALIDITY_CHECK where CHECKER = 1 for update; commit;</check-valid-connection-sql>

谁能帮帮我
尝试更改SQL:
1.开始select * from DBSCHEMA.DB_VALIDITY_CHECK,其中CHECKER = 1,用于使用rs进行更新;提交;
1.开始select * from DBSCHEMA.DB_VALIDITY_CHECK,其中CHECKER = 1用于更新;commit; end;
准确的误差是:DB2 SQL错误:SQLCODE= -104,SQLSTATE=42601,SQLRRMC =*;开始选择;(,DRIVER=4。19.26

dkqlctbz

dkqlctbz1#

不能在复合语句中使用“SELECT INTO NOWHERE”。
应该是这样的:

begin 
  declare v1 int;

  select count (1) into v1 
  from DBSCHEMA_DB_VALIDITY_CHECK 
  where checker=1 
  with rs use and keep update locks;

  -- your code is here
  -- ...

  commit;
end

fiddle

相关问题