Page 1 of 1
Return Parameter for StoredProcedure
Posted: Tue 18 Jun 2013 12:08
by michaelJ
Hi,
it is possible to use a ReturnParameter (from a Insert Statement with ...returning ...) in a StoredProcedure using TIBCSQL?
How can I do that to get the value in Delphi?
Re: Return Parameter for StoredProcedure
Posted: Wed 19 Jun 2013 07:25
by AndreyZ
Hello,
You can use the following code:
Code: Select all
begin
IBCSQL.CreateProcCall('new_dept');
IBCSQL.Execute;
ShowMessage(IBCSQL.ParamByName('deptno').AsString);
end;
, where NEW_DEPT is the following stored procedure:
Code: Select all
create procedure new_dept
returns (
deptno integer)
as
begin
insert into dept(deptno) values(next value for gen_dept) returning deptno into :deptno;
end
, dept is the following table:
Code: Select all
create table dept (
deptno integer primary key,
dname varchar(14),
loc varchar(13)
);
, and gen_dept is a generator.
Re: Return Parameter for StoredProcedure
Posted: Wed 19 Jun 2013 09:21
by michaelJ
Thank you - that answers my question!
Re: Return Parameter for StoredProcedure
Posted: Wed 19 Jun 2013 10:08
by AndreyZ
I am glad to help. If any other questions come up, please contact us.