Results 1 to 2 of 2

Thread: DB2 function

  1. #1
    Join Date
    Jul 2014
    Posts
    1

    Unanswered: DB2 function

    Hi all,

    I'm trying to create a DB2 function and I tried a lot of combinations but I can't get squirrel to create my function.

    I can create something like this:

    Code:
    CREATE FUNCTION MIGRATION.MyFunction2 (var1 char)
    RETURNS CHAR
    RETURN var1;
    but once I add a "BEGIN" and END statement it seems te fail.
    This is the function I would like to create:

    Code:
    CREATE function MIGRATION.determineToTaxService(DIGI_NAAR_VLG CHAR, DIGI_VAN_VLG CHAR, NAARVLG CHAR)
    	RETURNS CHAR
    BEGIN 
    	     DECLARE value CHAR
    	     SET value = '0'
    	     IF DIGI_NAAR_VLG = '1' THEN
    	    		SET value = '1'
    	     END IF
    	    	IF DIGI_VAN_VLG = '1' THEN
    	    		SET value = '1'
    	     END IF
    	     IF NAARVLG = '1' THEN
    	    		SET value = '1'
    	     END IF
    	     RETURN value
       	END@
    Last edited by greg002; 07-15-14 at 10:59.

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Your statement terminator is @, but you did not terminate the other lines ( for example, with semi-colon ).

Posting Permissions

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