Subject | Execute Statement fails on application but Ok in IBExpert |
---|---|
Author | Steve Harp |
Post date | 2005-10-19T16:14:05Z |
Hi All,
I have a selectable stored procedure that uses EXECUTE STATEMENT. In
my application, the stored procedure fails with an error,
"ISC ERROR CODE:335544829
ISC ERROR MESSAGE:
Variable type (position 1) in EXECUTE STATEMENT 'select ord.OrderID,
ord.OrderTypeID, ord.Customer,' INTO does not match return".
However, I can pass exactly the same string to IBExpert and run the
stored procedure in the debugger and it runs clean and returns the
correct result set.
The application uses a TIBOQuery with the SQL property set to:
select OrderID,
OrderTypeID,
Customer,
OrderDate,
EstShipDate,
Total,
TypeDate,
CubeWT
from spGetOutstandingOrders(:pSql)
The stored procedure is pretty simple.
create procedure spGetOutstandingOrders(sSql VarChar(1024))
returns (OrderID BigInt,
OrderTypeID BigInt,
Customer VarChar(30),
OrderDate Date,
EstShipDate Date,
Total Numeric(12,2),
TypeDate Date,
CubeWT Numeric(12,2))
AS
declare variable dMultiplier Numeric(12,3);
Begin
for execute statement :sSql
into :OrderID, :OrderTypeID, :Customer, :OrderDate,
:EstShipDate, :TypeDate, :dMultiplier
do
Begin
Total = 0;
CubeWT = 0;
if (Exists(Select OrderID
from xOrderDetail
where (OrderID = :OrderID))) then
Begin
Select Sum(ExtendedPrice), Sum(CubeWtExt)
from xOrderDetail
where (OrderID = :OrderID)
into :Total, CubeWt;
if (:dMultiplier <> 0) then
Total = (:Total * :dMultiplier);
Total = Cast(:Total AS Numeric(12,2));
CubeWT = Cast(:CubeWT AS Numeric(12,2));
End
suspend;
End
End
What am I doing wrong? Why is IBExpert running the exact same :pSql
string clean while my application is failing?
Thanks for any help,
Steve
I have a selectable stored procedure that uses EXECUTE STATEMENT. In
my application, the stored procedure fails with an error,
"ISC ERROR CODE:335544829
ISC ERROR MESSAGE:
Variable type (position 1) in EXECUTE STATEMENT 'select ord.OrderID,
ord.OrderTypeID, ord.Customer,' INTO does not match return".
However, I can pass exactly the same string to IBExpert and run the
stored procedure in the debugger and it runs clean and returns the
correct result set.
The application uses a TIBOQuery with the SQL property set to:
select OrderID,
OrderTypeID,
Customer,
OrderDate,
EstShipDate,
Total,
TypeDate,
CubeWT
from spGetOutstandingOrders(:pSql)
The stored procedure is pretty simple.
create procedure spGetOutstandingOrders(sSql VarChar(1024))
returns (OrderID BigInt,
OrderTypeID BigInt,
Customer VarChar(30),
OrderDate Date,
EstShipDate Date,
Total Numeric(12,2),
TypeDate Date,
CubeWT Numeric(12,2))
AS
declare variable dMultiplier Numeric(12,3);
Begin
for execute statement :sSql
into :OrderID, :OrderTypeID, :Customer, :OrderDate,
:EstShipDate, :TypeDate, :dMultiplier
do
Begin
Total = 0;
CubeWT = 0;
if (Exists(Select OrderID
from xOrderDetail
where (OrderID = :OrderID))) then
Begin
Select Sum(ExtendedPrice), Sum(CubeWtExt)
from xOrderDetail
where (OrderID = :OrderID)
into :Total, CubeWt;
if (:dMultiplier <> 0) then
Total = (:Total * :dMultiplier);
Total = Cast(:Total AS Numeric(12,2));
CubeWT = Cast(:CubeWT AS Numeric(12,2));
End
suspend;
End
End
What am I doing wrong? Why is IBExpert running the exact same :pSql
string clean while my application is failing?
Thanks for any help,
Steve