Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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).

call "dbo"."TestProc"();

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

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
2.7k293965
accept rate: 17%


With v12.0.1.3354 and DBISQL, the behaviour is somewhat different:

  • The message for the call statement looks the same.
  • For the select statement, the error message is similar (adding "The displayed results may be incorrect or incomplete.") but the "Show Details" button reveals the full error message:

alt text

permanent link

answered 20 Mar '12, 12:06

Volker%20Barth's gravatar image

Volker Barth
40.2k361549822
accept rate: 34%

edited 20 Mar '12, 12:07

Volker. Your responses are incredible fast. To much spare time ? Thanks for your support. I hope you can keep the speed for a long time.

(20 Mar '12, 12:25) Thomas Dueme...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×119
×113
×43

question asked: 20 Mar '12, 11:54

question was seen: 4,643 times

last updated: 20 Mar '12, 12:25