When I use raiserror in a function or procedure that is used by a select statement the Error Message is not clear to understand.
call sa_make_object('procedure', 'TestProc', 'dbo'); ALTER PROCEDURE "dbo"."TestProc"() -- Return a Result Set for testing RESULT ( page_count integer ) BEGIN declare local temporary table TestProcTable( table_page_count integer ); insert into TestProcTable( table_page_count) SELECT "SYS"."SYSTABLE"."table_page_count" FROM "SYS"."SYSTABLE" WHERE "SYSTABLE".table_type = 'BASE'; message @@rowcount type info to client; -- Generate the Error raiserror 20000; select table_page_count as page_count from TestProcTable END;
When the Procedure is called directly the Error Message is clear and the error number 20000 shows directly on the screen (in iSQL).
If the call is embedded in a select statement like
select page_count from "dbo"."TestProc"();
the Error message states
There was an error reading the results of the SQL statement.
Behind the Show Details Button I can only read
[Sybase][ODBC Driver][SQL Anywhere]RAISERROR executed:
I used currently ASA 10 and would be interested if newer versions behave differently.
The second error message describes more the symptom of the error instead of getting to the point of the problem.
I would be interested if this is only a problem for me or if other users would also prefer the direct raiserror message for this type of errors.
Perhaps you can give me your thoughts on this. Kind Regards
asked 20 Mar '12, 11:54
With v22.214.171.12454 and DBISQL, the behaviour is somewhat different: