on 2015 Jan 20 1:13 PM
Note: This was originally posted as an answer to that question but seems to be a question on its own.
I moved it via the "convert to question" button and hope the title will fit...
Hi. I've the same problem. In my DB1 I have created a function (named "fn-Date") with no parameters that returns a varchar(8) value. In my DB2 I have created a remote function as follow:
CREATE PROCEDURE "ergon"."Remote-fn-Date"() at 'RemoteServer;;Ergon;fn-Date';
But .... using DB2:
SELECT Remote-fn-Date()
... the result is always "0" (zero)
Thank you for reporting this issue. DECIMAL types are not supported as RETURN values for a remote function. That being said, the server certainly should not crash if you try to make a remote function call with a DECIMAL return type. The problem has now been fixed and a future SP will properly report that DECIMAL types are not supported as RETURN values for remote functions rather than having the server crash.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try creating a function, not a procedure:
CREATE FUNCTION "ergon"."Remote-fn-Date"() RETURNS VARCHAR ( 8 ) at 'RemoteServer;;Ergon;fn-Date';
Procedures do have a "return value" that is an integer return code, which may explain the zero... but I'm just guessing at that part (almost nobody uses the procedure-return-value feature).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Breck.
It works !!
I've re-generated a test case using a simple Function that returns an integer.
... But using a function that return a decimal type ... I've experienced a server CRASH !!! (SA 12.0.1.3873)
From doc:
....
NUMERIC and DECIMAL data types are allowed for IN parameters, but not for OUT or INOUT parameters ...
... nothing about remote function return values ...
Well, that is a documented restriction, cf. the docs on CREATE FUNCTION - to cite:
A proxy function can return any data type except DECIMAL, NUMERIC, LONG VARCHAR, LONG NVARCHAR, LONG BINARY, XML, or any spatial data type.
(I ain't saying that ignoring this restriction should lead to a server crash, of course...)
I guess you will have to wrap the remote function on the remote database (say, by wrapping "fnFunc" with "fnFuncAsDouble") and then map the proxy function to that remote wrapper (and declare the proxy function with the according return datatype).
Besides that, you may raise another question here to post the server crash issue - I would expect that an unfitting "remote function return datatype" should raise an SQL error code, not a crash...
User | Count |
---|---|
68 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.