Alexey Gaidukov wrote :
>Gesendet: Montag, 17. Oktober 2005 11:52
>An: [email protected]
>Betreff: Re: empty resultset if UDF in select throws exception $rc=100
>
>
> From my point of view this behavior is incorrect because $rc=100 is
>correct only in UDF context. In context of select statement
>this $rc=100
>is wrong.
>
>
>
>Alexey Gaidukov пишет:
>
>> create table gis.test2 (
>> resid varchar(10) UNICODE
>> )
>> //
>> create function GIS.ret_test
>> returns varchar AS
>> VAR
>> f varchar(10);
>> begin
>> try
>> select resid into :f from gis.test2;
>> return f;
>> CATCH
>> STOP($rc, $errmsg);
>> end;
>> //
>> create table temp.test (
>> resid varchar(10) UNICODE
>> )
>> //
>> insert into temp.test values (null)
>> //
>> insert into temp.test values ('1000')
>> //
>> select resid,GIS.ret_test() from temp.test
>>
>>
>> returns empty resultset. Is it by design?
>>
>>
>>
If you leave the UDF via STOP you signal the caller that an error occured, i.e.
the error 100 leaves the context of the function. Besides, we recommend not to
use MaxDB error codes for the stop statement. You should for example use error
codes between 31000 and 32000 .
If 100 is ok in your function you should not leave with STOP(100). Instead you
should leave without STOP. Of course you must provide a return values in this
case :
create function GIS.ret_test
returns varchar AS
VAR
f varchar(10);
begin
try
select resid into :f from gis.test2;
return f;
CATCH
if $RC = 100
THEN
return NULL
ELSE
STOP($rc, $errmsg);
end;
Best Regards,
Thomas
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]