OCL

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
cwallukat

OCL

Post by cwallukat » Tue 22 Aug 2006 11:46

Hi all,


i have downloaded the OCL from your WebSite.

I try to execute a storred procedure on an oracle database which returns a recordset.

I have tryed it with

exec procname param

and

call procname(param)

both does not work ...

In the two cases i get an ORA-20004 (Unknown error) exception ...

If i call a procedure without a parameter it works ...

We are already using ODAC in Delphi and there we used the TORAStoredProc class, which does not exist in this lib.


Is this a limitation, or not possible ?
Does somebody has an working example ?


Kr


Christian

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Tue 22 Aug 2006 16:16

Please try the following code

Code: Select all

  OraConnection connection;
  connection.open("test/test@ora");

  connection.startTransaction();
  OraCommand cmd1( connection, (LPCTSTR)"begin INOUT_STR_PROC(:p); end;" );
  OraParam *p1 = &cmd1.param(0);
  p1->setName("p");
  p1->setDataType(dtVarChar);
  p1->setString("11");
  p1->setDirection(pdInputOutput);

  cmd1.execute();

  CRString s = cmd1.param(0).getString();

Code: Select all

CREATE PROCEDURE INOUT_STR_PROC
(
  varchar_p1 IN OUT VARCHAR2
) IS
BEGIN
  varchar_p1 := varchar_p1 || '1234567890';
END INOUT_STR_PROC;

Post Reply