RETURN
From SQL PL Guide for DB2
RETURN statement
The RETURN statement can be used to immediately terminating and leaving a stored procedure. Furthermore it can be used to return a status of a stored procedure. This return status you can check in the calling stored procedure by the GET DIAGNOSTICS statement.
Example:
create procedure proc_return
begin
declare num_rows int;
set num_rows = (select count(*) from syscat.tables where tabschema <> 'SYSIBM' and type = 'T');
if num_rows = 0 then
return -1;
else
return 0;
end if;
end!