I have created a stored function in DB2. If I add BEGIN ATOMIC, it doesnt work. But if I dont use BEGIN ATOMIC, it works. Could you please help to explain what BEGIN ATOMIC causes and why we need it? I tried to read the documentation, but still could not understand:
CREATE OR REPLACE FUNCTION "schema"."myfunc" () RETURNS VARCHAR(20)
NO EXTERNAL ACTION
Always give the SQLCODE & SQLSTATE (do not say "does not work") because we cannot see what is on your screen.
HINT: you need to change the statement delimiter from the default (semi-colon) to a different character, for example in your script (if you run the code through the command line processor) use
--#SET DELIMITER @
and end the function definition with the @ delimiter (you can use other characters like ! etc)
If you are not using CLP, using some GUI, tell that GUI configuration to use a different statement delimiter.