TOraStoredProc - multi-params where one is a ref cursor
Posted: Fri 20 Apr 2007 14:18
In Oracle I have created a package and it has a procedure that has 2 parameters, one is a varchar2 and the second is a ref cursor. I am using Borland C++ 6 and want to use a TOraStoredProc to execute the procedure and return a dataset.
Here is the package:
Initially I had only the ref cursor (param curvar_out) as a parameter, and I am able to use the TOraStoredProc to execute it and return a dataset, and loop though the dataset as one would with a TOraQuery.
However, adding a parameter I cannot get it to work.
Here is the C++ code:
Here is the error:
Here is the package:
Code: Select all
create or replace package "Dev".Test
AS
type curvar_type is ref cursor return address_type%rowtype;
procedure get_address_types (str in varchar2, curvar_out out curvar_type);
END;Code: Select all
create or replace package body "Dev".Test
AS
procedure get_address_types
(str in varchar2, curvar_out out curvar_type)
AS
local_cur curvar_type;
BEGIN
open local_cur for select * from address_type;
curvar_out := local_cur;
END;
END Test;However, adding a parameter I cannot get it to work.
Here is the C++ code:
Code: Select all
TOraStoredProc* procTest = NULL;
TParam* param = NULL;
String type, displayOrder;
if (!procTest)
{
procTest = new TOraStoredProc(0);
procTest->Session = oraSession;
procTest->StoredProcName = "dev.test.get_address_types";
procTest->ParamCheck = false;
param = procTest->Params->CreateParam(
ftString,
"str",
ptInput);
procTest->Params->AddParam(param);
}
String sql;
try
{
procTest->ParamByName("str")->AsString = "Hello";
procTest->Open();
}
catch (const Exception& e)
{
String errMsg = e.Message;
int k = 5;
}Any help would be appreciated.ORA-06550: line 2, column 3:
PLS-00306: wrong number or types of arguments in call to 'GET_ADDRESS_TYPES'
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored