Passing Record Type to Stored Procedure

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Tom Miller
Posts: 2
Joined: Tue 15 Apr 2008 16:07

Passing Record Type to Stored Procedure

Post by Tom Miller » Tue 15 Apr 2008 16:11

Hi,

We would like to use a record type in passing data to our "Insert" and "Update" stored procedures instead of a huge parameter list of each and every field.

Does ODAC support this?

Thanks.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 16 Apr 2008 11:54

TOraStoredProc component does not supports record types. But if you call a stored procedure using PL/SQL block in SQL, SQLInsert or SQLUpdate properties, you can use a record type.

Tom Miller
Posts: 2
Joined: Tue 15 Apr 2008 16:07

Post by Tom Miller » Wed 23 Apr 2008 18:31

Plash wrote:TOraStoredProc component does not supports record types. But if you call a stored procedure using PL/SQL block in SQL, SQLInsert or SQLUpdate properties, you can use a record type.
Which component? Does this allow for a return value(s). Any chance this is a feature that will be implemented in the near future?

Thanks.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 24 Apr 2008 07:38

You can use TOraQuery or TOraSQL component. For example:

Code: Select all

  OraQuery.SQL.Clear;
  OraQuery.SQL.Add('DECLARE');
  OraQuery.SQL.Add('  rec mypack.myrec;');
  OraQuery.SQL.Add('BEGIN');
  OraQuery.SQL.Add('  rec.a := :a;');
  OraQuery.SQL.Add('  rec.b := :b;');
  OraQuery.SQL.Add('  :Result := mypack.myproc(rec);');
  OraQuery.SQL.Add('END;');

  OraQuery.ParamByName('a').AsInteger := 1;
  OraQuery.ParamByName('b').AsString := 'zzz';
  OraQuery.Execute;
  r := OraQuery.ParamByName('Result').AsInteger;
TOraStoredProc component does not support record types because OCI does not support parameters of such types.

Post Reply