Delphi access bind variable through TOraDataSet of ODAC

58 Views Asked by At

I've been trying to access the output of bind variables i.e. SELECT COUNT(*) INTO var_name FROM tbl; in a TOraDataSet instance of the ODAC library.

The intended variable gets declared twice. Once through FOraDataSet.SQL:

DELCARE c_count Integer;
BEGIN
SELECT COUNT(id) INTO c_count FROM customers
END;

and once through FOraDataSet.Params:

var lVariable := FOraDataSet.Params.AddParameter as TOraParam;
lVariable.Name := 'c_count';
lVariable.ParamType := ptOutput;
lVariable.DataType := dtInteger;
lVariable.Value := Null;

Despite having two instances of the variable c_count it still won't return the result after a FOraDataSet.Execute. The SQL statement by itself works.

What am I missing or more likely, what have I misunderstood?

UPDATE:

Despite going down the road of taking the output directly from a regular query involves a lot less hassle, it is important for our project that these values get extracted from the variables.

0

There are 0 best solutions below