Forum > Databases

SQLdb Execute procedure in Firebird

(1/1)

wiesiek:
I have

--- SP in Firebird

SET TERM ^ ;
CREATE PROCEDURE UNI_VAL
RETURNS (u_id INTEGER)
AS
BEGIN
    u_id = GEN_ID(gen_uni_val,1);
END ^
SET TERM ; ^

--- procedure in Lazarus

procedure TForm1.Button2Click(Sender: TObject);
begin
  SQLQuery2.SQL.Text := 'EXECUTE PROCEDURE UNI_VAL';
  SQLQuery2.ExecSQL;
  //
  //    ???     where is a ret val   ???
  //
end;

jesusr:
It seems it lacks the command SUSPEND; before the END^. AFAIK It's at that moment when values are transfered I'm not sure if it works without it though, I always have it if stored procedure returns values. Then to the get the value you do something like:

--- Code: ---
SQLQuery2.Close;
SQLQuery2.Sql.Text:='SELECT U_ID from UNI_VAL';
SQLQuery2.Open;
// TheValue:=SQLQuery2.Fields[0].ASInteger;

--- End code ---

HTH.

wiesiek:
Very Thanks. :-)

Navigation

[0] Message Index

Go to full version