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 )
    declare local temporary table TestProcTable( table_page_count integer );
    insert  into TestProcTable( table_page_count)
    SELECT  "SYS"."SYSTABLE"."table_page_count"
    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

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...
accept rate: 15%

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
accept rate: 32%

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



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:


question asked: 20 Mar '12, 11:54

question was seen: 2,074 times

last updated: 20 Mar '12, 12:25