DB2, create stored procedure error, sqlcode = – 104, sqlstate = 42601, PSM_ semicolon

Database editing software Aqua Data Studio/DbVisualizer
stored procedures as follows:

create or replace procedure DM.proc_test(
	in i_seq integer,
	out o_flag integer 
)
begin
  declare v_test varchar(20);
end;

[CREATE]DB2 SQL Error:SQLCODE=-104,SQLSTATE=42601,SQLERRMC= end-of-statement; E v_test varchar(20); < psm_semicolon>
[END]DB2 SQL Error:SQLCODE=-104,SQLSTATE=42601,SQLERRMC=END-OF-STATEMENT; END; JOIN < joined_table>

[CREATE]DB2 SQL Error:SQLCODE=-104,SQLSTATE=42601,SQLERRMC=END-OF-STATEMENT;E v_test varchar(20);<psm_semicolon>
[END]DB2 SQL Error:SQLCODE=-104,SQLSTATE=42601,SQLERRMC=END-OF-STATEMENT;END;JOIN <joined_table>

for database editing software or command Windows, the default closing symbol is “;” , so when the stored procedure above is executed, the statement will end only before the end statement.

modify the editor’s statement terminator to be other symbols
1) command window modify statement terminator (example, change to @) :
delimiter @
2) database software, modify the delimiter (delimiter) to be other in configuration

Read More: