I'd like to call a stored procedure, that has a parameter of type TABLE
.
How can I do this using OCCI
(11g1) in a windows C++ application?
Here's the definition of the stored procedure:
FUNCTION am_send(
p_caFnr IN VARCHAR2,
p_TabBgr IN DSKS_BGR_TAB,
p_caTextout OUT VARCHAR2)
RETURN NUMBER;
and the used types:
create or replace
TYPE DSKS_BGR_TAB,
AS TABLE OF DSKS_BGR
create or replace
TYPE DSKS_BGR
(BgrNr VARCHAR2(3),
TrId VARCHAR2(8))
What I have done so far:
I created a object representation of type DSKS_BGR
using the OTT Utility.
My code so far:
Environment* env = Environment::createEnvironment(Environment::OBJECT);
try
{
Connection *con = env->createConnection("xxxxx", "xxxxx", "xxxxx");
Statement* statement = con->createStatement("BEGIN :1 := am_send(:2, :3, :4); END;");
statement->registerOutParam(1, OCCINUMBER);
statement->setString(2, "Test");
// ?? DSKS_BGR_TAB
statement->registerOutParam(4, OCCISTRING, 1000);
statement->execute();
int result = statement->getNumber(1);
string textOut = statement->getString(4);
env->terminateConnection(con);
}
catch(const SQLException &exc)
{
cout << exc.getErrorCode() << exc.getMessage();
}
Environment::terminateEnvironment(env);
I have no idea how to set the TABLE
parameter.