Delphi and Interbase stored proc problem

I have the following stored procedure which appears to give sensible answers.

SET TERM !! ;
CREATE PROCEDURE gettransdets (jobid integer)
RETURNS  
(
dpexps             decimal (12,2) ,
execexps       decimal (12,2) ,
fieldexps       decimal (12,2) ,
otherexps       decimal (12,2) ,
sales             decimal (12,2) ,
trandate       date
)
as begin
for SELECT
            DPEXPS,
            EXECEXPS,
            FIELDEXPS,
            OTHEREXPS,
            SALES,
            TRANDATE
FROM
 TRANS
where jobid = :jobid

      into
:DPEXPS,
:EXECEXPS,
:FIELDEXPS,
:OTHEREXPS,
:SALES,
:TRANDATE
      do
      suspend;
END !!
SET TERM ; !!


If I run
select * from gettransdets(9000) in the WISQL window I get sensible answers

I am now trying to get delphi to control the query with a Tquery which says

Select * from Gettransdets where jobid =:numb

and then

query1.close
query1.parambyname('numb').asinteger := 9000;
query1.open;


This fails every time with a message about parameter mismatch.

Can any kind sould tell me what it is I'm doing wrong and perhaps more to the point how to correct it


Thank you

jbehAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

karooCommented:
hi jbeh,

this works:

procedure OpenTrans(jobid: Integer);
begin
  Query1.Close;
  Query1.SQL.Clear;
  Query1.SQL.Add('Select * from gettransdets(' +IntToStr(jobid) +')';
  Query1.Open;
end;

the paramcheck of Query1 is set to false.

there is a couple of other ways but this is the easiest one because you can expand your Parameters easily if necesary.

Regards  Ben:)
0
jbehAuthor Commented:
So I'm circumventing the normal way of passing parameters to a Delphi query.......

Interesting - I'll try it and see what happens and get back to you

Thank you

0
karooCommented:
jbeh,

I would say the normal way a SP works is when the result returned is a singular result set(input and output params), in your case it is not.

Youre query could just as well work if youre Query SQL for the Query is:
SELECT Fields...
FROM TRANS
WHERE JOBID =:jobparam

In this case you would use:
query1.close
query1.parambyname('jobparam').asinteger := 9000;
query1.open;

it would work just as well.
0
jbehAuthor Commented:
Yes - I totally agree that I could do it that way ..

However I wanted to see how to do it - This was my first experiment of this nature and i was getting very frustrated with it..

Presumably the SP method will in principle be marginally faster.


Anyhow if you'd do the necessary bits and pieces at your end I'll happily release the points

Thanks a lot




0
karooCommented:
glad to have helped:)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.