Cursor Variables -TOracleQuery -TOracleDataSet and ORA-01036

Stefano

Member
Help for setting cursor variables at runtime.

My packaged is :
type t_anag_cursor is ref cursor return mum_ana%rowtype;

procedure SearchRecord(p_anag_cursor in out t_anag_cursor,
p_cognome mum_ana.cognome%type,
p_nome mum_ana.nome%type,
p_data_di_nascita mum_ana.data_di_nascita%type) is
begin
open p_anag_cursor for select * from mum_ana a
where
a.cognome = p_cognome and
a.nome = p_nome and
a.data_di_nascita = p_data_di_nascita;
end;

When push botton
var
Call: string;

begin
Call := 'ma_pk.searchrecord(
tongue.gif
_anag_cursor,
tongue.gif
_cognome,
tongue.gif
_nome,
tongue.gif
_data_di_nascita)';
with Query do
begin
Clear;
SQL.Add('begin');
SQL.Add(' ' + Call + ';');
SQL.Add('end;');
// Declare
DeleteVariables;
DeclareVariable('p_anag_cursor', otCursor);
DeclareVariable('p_cognome', otString);
DeclareVariable('p_nome', otString);
DeclareVariable('p_data_di_nascita', otDate);
// Set variables

SetVariable('p_cognome', Edit1.Text);
SetVariable('p_nome', Edit2.Text);
if IsDate(MaskEdit1.Text) = true then
SetVariable('p_data_di_nascita', StrToDate(MaskEdit1.Text));
SetComplexVariable('p_anag_cursor' , Query);
OraDataSet.DeclareQueryVariables(Query);
OraDataSet.SetQueryVariables(Query);
// Execute
Query.Execute;
end;
end;

when query.execute :"ORA-01036 Illegal Variable Name/number when calling stored procedure "

This problem not sussiste if I setting a designtime a TOracleDataSet directly.
Thanks

------------------
 
Why are you doing this:

OraDataSet.DeclareQueryVariables(Query);
OraDataSet.SetQueryVariables(Query);

This will declare and set variables for all dataset fields. It is only useful in the OnApplyRecord event handler. Does it work correctly if you omit this?

------------------
Marco Kalter
Allround Automations
 
Back
Top