return: text
lang: plpgsql
parameters:
  p0:
    type: text
    name: i_formula
src: |
  DECLARE	
  	
  	
  	temp_cursor refcursor;
  	sqlcmd text;
  	_value text;
  	_return text;
  BEGIN
  	_return = '';
  	
  	sqlcmd = 'SELECT (' || i_formula ||')::text';
  	BEGIN 
  		OPEN temp_cursor FOR EXECUTE sqlcmd;
  		
  		FETCH temp_cursor INTO _value;
  		WHILE FOUND LOOP
  			_return = _value;
  		FETCH temp_cursor INTO _value;
  		END LOOP;
  		CLOSE temp_cursor;
  	EXCEPTION 
  	WHEN others THEN RAISE NOTICE 'Erreur %' , sqlcmd; 
  	END;
  	
  	RETURN _return;
  END;