Page 1 of 1
Riase error in Sybase with UNIDAC
Posted: Tue 23 Aug 2011 15:00
by sasdua
We are using Unidac Stored Proc Component in Delphi 10 with Sybase 12.5 drivers
In Sybase proc we are raising error like below,i found it is retruning back but it not showing error message.Is this not working in Unidac or any other issue?
we already using set ansinull off so comparision " null" is working for us..
if @number null
begin
select @errmsg = 'Already active for location '
raiserror 20001 @errmsg
return 1
end
In Delphi we are using UniStoredProc Component
Code: Select all
with StoredProcUpdate do
begin
ExecProc;
Open;
end;
it giving error like No Rows retruned ..if we remove open..it is going into if clause mentioned above but it not returning the the error message riased
i tried to execute stored proc using "try expect" also
Code: Select all
try
ExecProc;
except
DisplayException;
end
It is very urgent..pls help..is it bug in Unidac or my code is wrong? 
Posted: Wed 24 Aug 2011 10:53
by sasdua
If i try like below am able to catch exception with Sybase 15 Client Libraries but not with 12.5 client libraries
Code: Select all
try
ExecProc;
except on E:Exception do
begin
ErrorMsg(EDatabaseError(ExceptObject).Message,0);
Exit;
end;
Posted: Wed 24 Aug 2011 12:48
by AndreyZ
Hello,
I cannot reproduce the problem. I've created the stored procedure in the following way:
Code: Select all
create procedure test
as
begin
declare @errmsg varchar(30)
select @errmsg = 'Already active for location'
raiserror 20001 @errmsg
return 1
end
, and used the following code:
Code: Select all
try
UniStoredProc.StoredProcName := 'test';
UniStoredProc.ExecProc;
except
on E:EUniError do
ShowMessage(E.Message);
end;
As a result, the 'Already active for location' exception was raised. Please try using the code above and check if the problem persists.
Posted: Wed 24 Aug 2011 13:01
by sasdua
We are using Sybase 12.5 Client Libraries
Even with EUniError also am not able to Raise the exception.
Posted: Wed 24 Aug 2011 13:37
by sasdua
I believe it is raising unknown exception which we couldn't able to capture
Posted: Wed 24 Aug 2011 15:00
by sasdua
pls help in this regard we already postponed our release so many times
Posted: Thu 25 Aug 2011 13:49
by sasdua
Do you guys support Sybase 12.5 sybase client libraries or not?
Posted: Fri 26 Aug 2011 12:44
by AlexP
Hello,
We have checked this situation again. The error occurs regardless of the client version used (12.5 and 15). Please send us a complete DDL script of the procedure and the piece of code where the procedure parameters are set and the procedure is called.
Posted: Fri 26 Aug 2011 14:01
by sasdua
Alex,we have tried same example which AndreyZ has posted above even that also we are not able to catch
Posted: Fri 26 Aug 2011 14:03
by sasdua
Will it differs based on the server?
Our DB is on Sybase 15 server and we are connecting with Sybase 12.5 Client libraries will it matters?
or will it impact any how the fuctionality of the drivers?
Posted: Fri 26 Aug 2011 15:29
by AlexP
Hello,
I have tested this behavior exactly on the client 12.5 and server 15, and everything have worked perfectly. As I understood of the preceding, the operators are executed after the raiserror call (return 1). If this is the situation, the problem is most probably on the server side, not on the client side.
Posted: Mon 29 Aug 2011 05:00
by sasdua
Hi Alex..Thanks for checking..
Can you please let me Is there any configuration options to set on server,we are using Sybase 15.0.3 server.Please let us know which server you have tried on.
Alex i found one more thing..when we use uni query component and try to "exec proc" it is returning like "No rows returned"
Posted: Tue 30 Aug 2011 12:43
by AlexP
Hello,
We tried to reproduce the problem on the same server version – 15.0.3.
This error message is correct because if you call UniQuery.Open, it is expected that DataSet will be returned after execution, but as the procedure does not return DataSet, you are getting this error message. You can use the UniQuery.Execute method or the TUniStoredProc component to solve the problem.
Posted: Fri 02 Sep 2011 13:37
by sasdua
AlexP wrote:Hello,
We tried to reproduce the problem on the same server version – 15.0.3.
This error message is correct because if you call UniQuery.Open, it is expected that DataSet will be returned after execution, but as the procedure does not return DataSet, you are getting this error message. You can use the UniQuery.Execute method or the TUniStoredProc component to solve the problem.
you mean to say..you are not able to reproduce yet?
Posted: Wed 14 Sep 2011 10:43
by AlexP
Hello,
As I've told you earlier, this error ("No rows returned") occurs if procedure does not return DataSet, and you should call it with the help of the Exec method.