ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Function Return Issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function Return Issue

    Seems straight forward but always returns 0.

    Code:
    CREATE FUNCTION ABC.TEST ( 
    	AB VARCHAR(32) ) 
    	RETURNS INTEGER   
    	LANGUAGE SQL 
    	
    	BEGIN 
    IF 1 = 1 THEN 
                        
    	RETURN 1 ; 
    ELSE 
    	RETURN 2;
    	END IF ; 
    END  ;
    Returns all zeros
    Code:
    select ABC.TEST('') from PLKJVBT

  • #2
    Re: Function Return Issue

    Just copied, pasted and run it, without any problems, i.e. 1 is returned.

    Birgitta

    Comment


    • #3
      Re: Function Return Issue

      Hmmm. I am on V7r1. This is driving me crazy

      Comment


      • #4
        Re: Function Return Issue

        Did you check the joblog if there is a message?

        May be you created the function in an environment where commitment control is used. If so did you execute commit before running your SELECT statement?

        Comment


        • #5
          Re: Function Return Issue

          I don't know maybe I just had to many windows open and confused myself. It works now. Its always the stupid things

          Comment

          Working...
          X