| Author | 
		  Message
		 | 
		
		  | mark.luebinski | 
		  
		    
			  
				 Posted: Mon Feb 26, 2007 9:48 am    Post subject: ESQL Function with ROW-Return-value | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 27 Mar 2006 Posts: 56
  
  | 
		  
		    
			  
				Dear masters,
 
 
I would like to return ROW-Type as result of FUNCTION oder PROCEDURE in ESQL.
 
 
In editor it is all OK. But if I deploy my code, I get:
 
 
BIP2402E: (de.deutscherring.wbimb.lv.db_mappings.LV_StagingArea_beschreiben_ExtractTarife.getTarif, 1.60): Syntaxfehler: 'keyword Row'. 
 
 
My function was inside and outsind module and is VERY simple:
 
 
CREATE FUNCTION  getTarif( vp_nummer INT ) RETURNS ROW
 
	BEGIN
 
		DECLARE result ROW;	
 
		SET result = ROW(			Environment.Variables.SCHL_BEGR         AS SCHL_BEGR,
 
		
 
...
 
		RETURN result;		
 
	END;
 
 
What did I making wrong?
 
 
Thank you very much!!
 
 
Mark | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Mon Feb 26, 2007 9:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				You can't do this, I think.
 
 
I think you can return a reference, though. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mgk | 
		  
		    
			  
				 Posted: Tue Feb 27, 2007 9:58 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 31 Jul 2003 Posts: 1647
  
  | 
		  
		    
			  
				Jeff is correct. Functions and Procedures in ESQL cannot return ROWs or LISTs. 
 
 
 
Regards, _________________ MGK
 
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mark.luebinski | 
		  
		    
			  
				 Posted: Thu Mar 01, 2007 8:11 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 27 Mar 2006 Posts: 56
  
  | 
		  
		    
			  
				Dear Masters,
 
 
my toolkit-hint was, that it is possible, so I tried the ROW.
 
But if I now try to use REFERENCE it doesn't work.
 
 
	CREATE LASTCHILD OF OutputRoot.MRM NAME 'GRTK2Y4';
 
	MOVE tarifZeiger LASTCHILD;	
 
                getTarif(2, tarifZeiger);
 
 
Toolkit shows "Syntax Error".
 
Procedure is:
 
 
CREATE PROCEDURE  getTarif( IN vp_nummer INT, INOUT zeiger REFERENCE ) 
 
	BEGIN
 
	  DECLARE result ROW;
 
	  SET result = ROW(
 
	     Environment.Variables.SCHL_BEGR         AS SCHL_BEGR,
 
...
 
                  );
 
                  SET zeiger = result;
 
	
 
	END;
 
 
What is wrong here?
 
 
Thank you very much!!!
 
 
Mark | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Mar 01, 2007 8:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				You can't assign a ROW to a reference.
 
 
I don't know for sure that you can do this, but you can try:
 
   
	| Code: | 
   
  
	Declare myRef REFERENCE to result;
 
set zeiger = myRef; | 
   
 
 
 
You might be better off just doing 
   
	| Code: | 
   
  
	set zeiger=ROW(
 
Environment.Variables.SCHL_BEGR AS SCHL_BEGR,
 
...
 
);  | 
   
 
 _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mark.luebinski | 
		  
		    
			  
				 Posted: Fri Mar 02, 2007 5:03 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 27 Mar 2006 Posts: 56
  
  | 
		  
		    
			  
				Hi jefflowrey,
 
 
could it be, that Environment get LOST in this case?! I use my new Procedure in the SAME module as the MAIN-Procedure calling this getTarif() but the debugger shows no values for  Environment...  
 
 
Thank you very much!
 
 
Mark | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Mon Mar 05, 2007 7:16 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				The Environment tree should never get lost.
 
 
It may be that you didn't update it correctly, if you updated it inside a user defined procedure. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |