I have a very simple stored procedure which is below:
CREATE OR REPLACE PROCEDURE rc_name (id IN NUMBER, name OUT VARCHAR)
IS
BEGIN
SELECT receivable_class_name INTO name
FROM receivableclass WHERE receivable_class_id = id;
END;
/
I execute it in sqlplus using below:
DECLARE
B VARCHAR(100);
BEGIN
RC_NAME(99,B);
dbms_output.put_line('The rc class is ' ||B);
END;
/
This is executing perfectly and printing the value on console.
Now using otl I would like to call this stored procedure. below is the function.
void stored_proc(void)
{
int a=99;
char b[51];
try{
static otl_stream* mpOtltestProc;
static string testproc = "BEGIN"
"RC_NAME(:a<int>,:b<char[51]>)"
"END;";
if (mDbConnection == NULL)
mDbConnection = dbCxnManager::getConnection();
mpOtltestProc = new otl_stream(1, testproc.c_str(), *mDbConnection);
*mpOtltestProc<<a;
*mpOtltestProc>>b;
}
catch(otl_exception &p)
{
ORACLE_ERROR;
}
cout<<"B="<<b<<endl;
}
The problem I am facing is I am not getting this cout print the correct value. Its printing garbage.
Can anybody help me identify the wrong thing that I am doing here.