0
我在db2上創建一個過程,只有當表爲空時纔會將值插入到表中。我創建了下面的語句,但什麼是錯的,因爲我得到的錯誤:如果條件與FOR循環db2 plsql
[42601][-104] An unexpected token "END-OF-STATEMENT" was found
following "END FOR".
Expected tokens may include: " END IF".. SQLCODE=-104, SQLSTATE=42601,
DRIVER=4.7.85
create or REPLACE PROCEDURE proc1
BEGIN
IF (exists (select 1 from table1)) then
TRUNCATE TABLE table1;
ELSE
FOR l1 as
select id, max(bla) as bla from table2 group by id
do
insert into table1 (column1, column2)
values (id, bla);
END FOR;
END IF;
END;
的感謝!