Re: Returning multiple values from a C UDR
Posted in 2003
Topics: Stored Procedures & SPL, Versions, Editions & End-of-Life
I can think of following ways ...
1) use a select to retrieve out parameters. eg
select slv_out_one, slv_out_tow into v_out_one, v_out_two
from systables
where test(1,v_out_one # int,v_out_two #int) = <some_value>
and tabid = 1;Note that multiple OUT parameters are suppoted in IDS 9.4 only. In pre
9.4 servers, only the last parameter can be OUT.
2) If you can make the outer routine also a C UDR, then you can use
the FastPath mechanism to execute your C UDR with out parameters ( see
the DataBlade API programmer's Guide for FastPath)
3) You can combine all the COLLECTIONs and other datatypes in a ROW
type and return that.
hope this helps
Prasad
dohunt@hotmail.com (don hunt) wrote in message news:<1b56e975.0306031538.3ce47139@posting.google.com>...
> Is there any way to return multiple values from a C-UDR? I'm
> interested in the OUT parameters in a UDR definition. It looks like
> these can only be used in the WHERE clause of one SQL statement.
> Heres what I'm trying to do in SPL psuedo code.
>
>
> DEFINE v_out_one INTEGER;
> DEFINE v_out_two INTEGER;
> DEFINE v_return_val INTEGER;
>
> execute function test(1,v_out_one,v_out_two) into v_return_val;>
> -- use v_out_one and v_out_two
>
> this will not work with error:
> 9781: SLV cannot be an argument to a function invoked explicitly by> EXECUTE or CALL.
> Error in line 1> Near character position 38
> > informix@warhol 107% finderr 9781
> -9781 SLV cannot be an argument to a function invoked explicitly by
> EXECUTE
> or CALL.
>
> A routine that has an OUT parameter can only be invoked as part of a
> data-management language query (only in the WHERE clause). Do not
> invoke such a routine with a CALL or EXECUTE statement.
>
>
> I don't think I can do this with out params. I know I can create a
> collection and return that but in the real scenario I'm returning a
> lot of data for each output parameter (I would have multiple returned
> collections!)
>
> Thanks for any help or advise.