dbTalk Databases Forums  

Stored procedure now gives error

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Stored procedure now gives error in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jon Springs
 
Posts: n/a

Default Stored procedure now gives error - 08-04-2009 , 12:35 PM






I am running SQL Anywhere 9.0.2 on Windows XP and just applied the latest
EBF, 9.0.2.3850, and now a sotred procedure that worked without error on
9.0.2.3137, gives the following error:

'Error at line 1'
'proc_name returned a result set with a different schema than expected'

This makes no sense to me at all. Does anyone know if stored procedure
behavior or syntax or who knows what changed that would cause this error?

Thanks in advance,

--

-----Jon-----

Reply With Quote
  #2  
Old   
Karim Khamis [Sybase iAnywhere]
 
Posts: n/a

Default Re: Stored procedure now gives error - 08-04-2009 , 02:35 PM






Jon,

Are you using the stored procedure in the from clause of a SELECT
statement? If so, then be advised that the result set that the procedure
returns MUST match either the WITH clause or the RESULT clause on the
procedure declaration.

Karim
Jon Springs wrote:
Quote:
I am running SQL Anywhere 9.0.2 on Windows XP and just applied the latest
EBF, 9.0.2.3850, and now a sotred procedure that worked without error on
9.0.2.3137, gives the following error:

'Error at line 1'
'proc_name returned a result set with a different schema than expected'

This makes no sense to me at all. Does anyone know if stored procedure
behavior or syntax or who knows what changed that would cause this error?

Thanks in advance,

Reply With Quote
  #3  
Old   
Jon Springs
 
Posts: n/a

Default Re: Stored procedure now gives error - 08-04-2009 , 03:39 PM



Thanks Karim,

I will investigate this further.

--

-----Jon-----


"Karim Khamis [Sybase iAnywhere]" <kkhamis (AT) sybase (DOT) com> wrote

Quote:
Jon,

Are you using the stored procedure in the from clause of a SELECT
statement? If so, then be advised that the result set that the procedure
returns MUST match either the WITH clause or the RESULT clause on the
procedure declaration.

Karim
Jon Springs wrote:
I am running SQL Anywhere 9.0.2 on Windows XP and just applied the latest
EBF, 9.0.2.3850, and now a sotred procedure that worked without error on
9.0.2.3137, gives the following error:

'Error at line 1'
'proc_name returned a result set with a different schema than expected'

This makes no sense to me at all. Does anyone know if stored procedure
behavior or syntax or who knows what changed that would cause this error?

Thanks in advance,

Reply With Quote
  #4  
Old   
Jon Springs
 
Posts: n/a

Default Re: Stored procedure now gives error - 08-04-2009 , 04:11 PM



Yes, I am using the stored procedure in a select statement.

The documentation mentions returning a variable number of columns and does
not describe a 'return' or 'with' requirement. This procedure does return 3
or 4 columns depending on a condition passed to it.

--

-----Jon-----



"Karim Khamis [Sybase iAnywhere]" <kkhamis (AT) sybase (DOT) com> wrote

Quote:
Jon,

Are you using the stored procedure in the from clause of a SELECT
statement? If so, then be advised that the result set that the procedure
returns MUST match either the WITH clause or the RESULT clause on the
procedure declaration.

Karim
Jon Springs wrote:
I am running SQL Anywhere 9.0.2 on Windows XP and just applied the latest
EBF, 9.0.2.3850, and now a sotred procedure that worked without error on
9.0.2.3137, gives the following error:

'Error at line 1'
'proc_name returned a result set with a different schema than expected'

This makes no sense to me at all. Does anyone know if stored procedure
behavior or syntax or who knows what changed that would cause this error?

Thanks in advance,

Reply With Quote
  #5  
Old   
Karim Khamis [Sybase iAnywhere]
 
Posts: n/a

Default Re: Stored procedure now gives error - 08-05-2009 , 07:47 AM



Jon,

A procedure can return different result sets with different schemas
based on how it is called or what execution path is taken within the
procedure, but that only works well when the procedure is explicitly
called. When the procedure is used in the from clause of a select
statement, the expected result set's schema needs to be well defined and
declared up front using either the WITH clause or the RESULT clause.
Check the documentation for difference between calling a procedure
directly and calling it within the from clause.

Karim
Jon Springs wrote:
Quote:
Yes, I am using the stored procedure in a select statement.

The documentation mentions returning a variable number of columns and does
not describe a 'return' or 'with' requirement. This procedure does return 3
or 4 columns depending on a condition passed to it.

Reply With Quote
  #6  
Old   
Jon Springs
 
Posts: n/a

Default Re: Stored procedure now gives error - 08-05-2009 , 11:19 AM



Thnks, I'll look into it.

--

-----Jon-----

"Karim Khamis [Sybase iAnywhere]" <kkhamis (AT) sybase (DOT) com> wrote

Quote:
Jon,

A procedure can return different result sets with different schemas based
on how it is called or what execution path is taken within the procedure,
but that only works well when the procedure is explicitly called. When the
procedure is used in the from clause of a select statement, the expected
result set's schema needs to be well defined and declared up front using
either the WITH clause or the RESULT clause. Check the documentation for
difference between calling a procedure directly and calling it within the
from clause.

Karim
Jon Springs wrote:
Yes, I am using the stored procedure in a select statement.

The documentation mentions returning a variable number of columns and
does not describe a 'return' or 'with' requirement. This procedure does
return 3 or 4 columns depending on a condition passed to it.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.