Thanks.
If there is no exception with $rc=100 why in the following example in
case of ROW NOT FOUND MaxDB will returns DBPROC by STOP(100)?
create dbproc test(
OUT t varchar(10))
AS
begin
try
select field into :t from user.table where field2='123';
catch
if $rc=100 then
set t = 'not found'
else
stop($rc, $errmsg);
end;
From MaxDB 7.6 manual
If an SQL error occurs in the statement list between TRY and CATCH, the
system branches directly to the statement that follows CATCH.
So 100 is a SQL error.
In case of UDF $rc=100 is correct for context of UDF. This means ROW NOT
FOUND in UDF. As for me when I get ROW NOT FOUND in select I think that
select returns no data. I need some time to undestand that this error
code is from UDF.
Thanks in advance,
Alexey Gaidukov.
Anhaus, Thomas пишет:
Alexey Gaidukov wrote :
create function GIS.ret_test
returns varchar AS
VAR
f varchar(10);
begin
select resid into :f from gis.test2;
return f;
end;
//
select resid,GIS.ret_test() from temp.test
Returns two records. Where is in this case the exception with $rc=100?
Very strange behavior.
Why do you think this behavior is strange ? Please note that there's no
exception for error 100, there's just the variable $rc which contains
the value 100 after the select statement.
Since you didn't check this variable the function returns the initial
value of f, which is null.
Even if you use try/catch you are responsible to check $rc in the catch
block and you must decide whether this is an error to be ignored or to
be returned to the caller.
In the latter case you have to leave the function via a STOP statement.
To avoid misunderstanding you should choose error codes that do not
conflict with existing MaxDB error codes.
Best Regards,
Thomas
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]