Subject RE: [ib-support] Example Code
Author Mike Grover
Thanks Louis

-----Original Message-----
From: Louis van Alphen [mailto:lja@...]
Sent: Friday, August 31, 2001 3:03 AM
To: ib-support@yahoogroups.com
Subject: Re: [ib-support] Example Code


At 13:37 2001-08-30 -0500, you wrote:
>Does anybody know where I can find example SQL code for
>
>things like, Stored Procedures, Doing loops in stored procedures,
>
>passing parameters to stored procedures....
>

Example 1
---------------
in IB:

create procedure SP1(IN_PARAM1 INTEGER)
returns (OUT_PARAM1 INTEGER)
as
begin
for select INTEGER_COLUMN from TABLE
where SOME_COLUMN = :IN_PARAM1
into :OUT_PARAM1
do
suspend;
end
end

to use in Delphi, simply create a query:

qryTest.Close;
qryTest.SQL.Clear;
qryTest.SQL.Add('select * from SP1 (1)'); // or use a variable a the
parameter
qryTest.Open

while qryTest.EOF = Fasle do
begin
SomeVariable = qryTest.FieldByName('OUT_PARAM1').Value;
qryTest.Open;
end;

OR

set the SQL property to select * from SP1 (:InParam)
and then in code:

qryTest.Close;
qryTest.ParamByName('InParam').Value := 111;
qryTest.Open
SomeVariable = qryTest.FieldByName('OUT_PARAM1').Value;


HTH


L.J. van Alphen
Director
Basix Automation

E-mail: lja@...
WWW: http://www.basix.co.za
Tel: (+27) (0)21-409 7018


P.O. Box 6330
Roggebaai
8012
Cape Town
South Africa



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Speak up and rate leading IT and computer Web sites
Get a $10 AMAZON.COM Gift Certificate
http://us.click.yahoo.com/HjDtZD/Fd6CAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/