Page 1 of 1

TOraStoredProc without procname in odac 9.3.8

Posted: Sun 25 May 2014 09:09
by delphi7
hi,
i found a problem when i use a TOraStoredProc, without procname (odac 9.3.8), here is an example:
var a,b :string;
begin
try
store:=TOraStoredProc.Create(nil);
store.Session:=session;
if(a='query')then // like a simple query
store.SQL.Text:='select * from student' //like select query
else // like a stored procedure
begin
store.StoredProcName:=b;// b like a procname
store.FetchAll:=True;
store.PrepareSQL;
store.Params.Items[0].DataType:=ftCursor;
end;
if(a='query')then
store.Open
else
Store.execute;
except on E: Exception do showmessage ('error');
end;

the bug was: error storedprocname must be defined

this example works fine when i execute it with odac v9.0.1

thanks

Re: TOraStoredProc without procname in odac 9.3.8

Posted: Mon 26 May 2014 08:13
by AlexP
Hello,

The TOraStoredProc component is designed for execution of stored procedures, not queries. To implement the required functionality, you should either use both TOraStoredProc and TOraQuery or use just TOraQuery and the following code:

Code: Select all

if //using stored procedure
then begin
  TDBAccessUtils.CreateProcCall(OraQuery1, 'SP_TEST', true, false);
  OraQuery1.Execute;
end
else begin
  OraQuery1.SQL.Text:='select * from dual;
  OraQuery1.Open;
end;

Re: TOraStoredProc without procname in odac 9.3.8

Posted: Mon 26 May 2014 08:34
by delphi7
thanks for this code

Re: TOraStoredProc without procname in odac 9.3.8

Posted: Mon 26 May 2014 10:16
by AlexP
You are welcome. Feel free to contact us if you have any further questions.