[Lazarus] Stored Procedure and Returning Values

Kamil Walas kamilwalas85 at gmail.com
Sat Mar 28 09:13:59 CET 2009


Hi,

I try before but it didn't work. This procedure work if Ido
'Execute procedure ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac) ' 
but if I do
'SELECT * FROM ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac)'
I got nothing. It simply doesn't work that way.

Code with:

qry01.SQL.Text:= 'Execute procedure ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac) ';
qry01.Open.Active := True;

I get erreor: 'Statment cannot be performed on non-select stetment' or 
something like that and I must do

qry01.ExecSQL;

but I don't know how to get returning parameters in that kind of 
instruction.

Kamil

Eduardo Lopez pisze:
> Hi,
> you must do a "select * from ZnajdzKodKreskowy (:Kod, 0, 0, 0,
> :IleCyfrSprawdzac)"
>
> The example:
>
>    qry01.SQL.Clear;
>    qry01.SQL.Text:= 'select * from ZnajdzKodKreskowy (:Kod, 0, 0, 0,
> :IleCyfrSprawdzac)';
>    qry01.Params.ParamByName('Kod').AsString:= 'AAA';
>    qry01.Params.ParamByName('IleCyfrSprawdzac').AsString:= 'BBB';   // I
> don't know what type are your paremeters :-)
>    qry01.Open;
>    MyResult01:=qry01.FieldByName('Jest').AsString;
>    MyResult02:=qry01.FieldByName('Zlecenie').AsString;
>    MyResult03:=qry01.FieldByName('...others...').AsString;
>    qry01.Close;
>
> Have a nice weekend!
>
> Eduardo.
>
> Kamil Walas escribió:
>   
>> Hi,
>>
>> I have stored procedure in FireBird:
>> EXECUTE PROCEDURE ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac)
>> RETURNING_VALUES (:Jest, :Zlecenie, :I1, :I2, :I3, :I4, :D, :I5, :S);
>>
>> I was trying to get returning values to lazarus code, but I couldn't. I 
>> find out that there is no StoredProcedure element from Delphi. How could 
>> I get this values? I would be pleased if someone wrote an example.
>>
>> And sorry for my English.
>>
>> Best regards,
>> Kamil Walas
>>  
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>>   
>>     
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>   




More information about the Lazarus mailing list