Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: begin atomic in stored function

    Hallo everyone,

    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:

    Code:
    CREATE OR REPLACE FUNCTION "schema"."myfunc" () RETURNS VARCHAR(20)
    LANGUAGE SQL 
    CONTAINS SQL 
    NO EXTERNAL ACTION 
    DETERMINISTIC
    
    BEGIN ATOMIC
    	
    	return 'something';
    
    END
    The above code doesnt work.


    Regards,

    Ratna
    Last edited by ratnalein; 10-22-13 at 13:35.

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Quote Originally Posted by ratnalein View Post
    The above code doesnt work.
    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
    Code:
    --#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.

  3. #3
    Join Date
    May 2012
    Posts
    155
    Hallo db2mor,

    thank you for the hint, it helped me solving the Problem.

    Regards,

    Ratna

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •