Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call an Oracle function from Delphi?

I created a function in Oracle that inserts records in specific tables and return an output according to what occurs within the function. e.g (ins_rec return number)

How do I call this function and see its output in Delphi?

I got a reply (with all my thanks) for sql plus but I need to know how can I do this in Delphi

like image 790
maher Avatar asked Feb 26 '11 15:02

maher


People also ask

How do you call a method in Delphi?

You can make the call using the declared name of the routine (with or without qualifiers) or using a procedural variable that points to the routine. In either case, if the routine is declared with parameters, your call to it must pass parameters that correspond in order and type to the parameter list of the routine.

Can procedure Call function Oracle?

Answer: Yes, it is possible. In the declaration section of the procedure, you can declare and define a function.


1 Answers

Just pass the user defined function as column name in the query and it will work.

Example:

Var
  RetValue: Integer;
begin
  Query1.Clear;
  Query1.Sql.Text := 'Select MyFunction(Param1) FunRetValue from dual';
  Query1.Open;

  if not Query1.Eof then
  begin
    RetValue := Query1.FieldByName('FunRetValue').AsInteger;
  end;
end;
like image 73
Bharat Avatar answered Oct 04 '22 22:10

Bharat