Hi all
i'm tring to do a code to get an array of strings from an oracle db
using OCI.
the program fails ( i believe) and i dont' know how to do this.
here is the code
sorry for the bad code quality


int main(argc, argv)
int argc;
char *argv[];
{
OraText *cstring=(OraText*)"GIS.LOCALDOMAIN";

/* Initialize the environment and allocate handles */
if ((ret = OCIEnvCreate((OCIEnv **) &envhp, (ub4) OCI_DEFAULT | OCI_OBJECT,
(dvoid *) 0, (dvoid * (*)(dvoid *,size_t)) 0,
(dvoid * (*)(dvoid *, dvoid *, size_t)) 0,
(void (*)(dvoid *, dvoid *)) 0, (size_t) 0, (dvoid **) 0))
!= OCI_SUCCESS) {

chk_err(errhp,ret,__LINE__,(OraText *)"OCIEnvCreate");
return OCI_ERROR;
}

/* allocate error handle */
if ((ret = OCIHandleAlloc((dvoid *) envhp,(dvoid **) &errhp,OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIHandleAlloc: errhp");
return OCI_ERROR;
}

/* allocate server handle */
if ((ret = OCIHandleAlloc ( (dvoid *) envhp,(dvoid **) &srvhp,OCI_HTYPE_SERVER,
(size_t) 0, (dvoid **) 0)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIHandleAlloc: srvhp");
return OCI_ERROR;
}

/* allocate service context handle */
if ((ret = OCIHandleAlloc ( (dvoid *) envhp,(dvoid **) &svchp,OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIHandleAlloc: svchp");
return OCI_ERROR;
}

/* allocate session handle */
if ((ret = OCIHandleAlloc((dvoid *) envhp,(dvoid **) &authp,OCI_HTYPE_SESSION,
(size_t) 0,(dvoid **) 0)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIHandleAlloc: authp");
return OCI_ERROR;
}

/* allocate statement handle */
if ((ret = OCIHandleAlloc(envhp,(dvoid*) &stmthp,
OCI_HTYPE_STMT, 0, (dvoid **)0)) != OCI_SUCCESS) {
printf("Error in getting stmt handle\n");
return OCI_ERROR;
}

/*********************************** LOGIN SESSION ************************************/

if ((ret = OCIServerAttach( srvhp,errhp,(OraText *) cstring,
(sb4) strlen((char *)cstring), OCI_DEFAULT)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIServerAttach");
return OCI_ERROR;
}

/* set server attribute to service context */
if ((ret = OCIAttrSet((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX,
(dvoid *) srvhp, (ub4) 0, (ub4) OCI_ATTR_SERVER, errhp))
!= OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIAttrSet: OCI_HTYPE_SVCCTX");
return OCI_ERROR;
}

/* set user attribute to session */
if ((ret = OCIAttrSet ( (dvoid *) authp,OCI_HTYPE_SESSION,
(dvoid *) user, (ub4) strlen((char *)user),
(ub4) OCI_ATTR_USERNAME, (OCIError *) errhp)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIAttrSet: OCI_ATTR_USERNAME");
return OCI_ERROR;
}

/* set password attribute to session */
if ((ret = OCIAttrSet ( (dvoid *) authp,OCI_HTYPE_SESSION,
(dvoid *) password, (ub4) strlen((char *)password),
(ub4) OCI_ATTR_PASSWORD,(OCIError *) errhp)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIAttrSet: OCI_ATTR_PASSWORD");
return OCI_ERROR;
}

/* Begin a session */
if ( (ret = OCISessionBegin (svchp,errhp,authp,OCI_CRED_RDBMS,
OCI_DEFAULT)) == OCI_SUCCESS)
printf("Logged in!\n\n");
else {
chk_err(errhp,ret,__LINE__,(OraText *)"OCISessionBegin");
return OCI_ERROR;
}

/* set session attribute to service context */
if ((ret = OCIAttrSet((dvoid *)svchp, (ub4)OCI_HTYPE_SVCCTX,
(dvoid *)authp, (ub4)0,(ub4)OCI_ATTR_SESSION, errhp))
!= OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIStmtPrepare");
return OCI_ERROR;
}

/************************************************PL/SQL*******************************/


OraText *sqlstmt = (OraText *)"BEGIN :valore := gisuser.getvincoli(:emp_number); END; ";

//OraText *sqlstmt = (OraText *)"BEGIN :valore := pippo; END; ";

if ((ret = OCIStmtPrepare(stmthp, errhp, sqlstmt, (ub4)strlen((char *)sqlstmt), OCI_NTV_SYNTAX,
OCI_DEFAULT)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIStmtPrepare");
return OCI_ERROR;
}

checkerr( errhp, OCIBindByName(stmthp, &bnd1p, errhp, (text *) ":emp_number",
-1, (ub1 *) &empno,
(sword) sizeof(empno), SQLT_INT, (dvoid *) 0,
(ub2 *) 0, (ub2) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT));


OCIArray *stringout;

if ((ret = OCIBindByPos(stmthp,&bndhp[0],errhp,1,(dvoid *)stringout,
(sb4) 3, SQLT_NTY, (dvoid *)0,
(ub2 *) 0,(ub2 *) 0,(ub4) 0,(ub4 *)0,OCI_DEFAULT)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIBindByPos");
return OCI_ERROR;
}

OCIString * input=(OCIString *)"vinc1;vinc2;vinc3";

if ((ret = OCIBindByPos(stmthp,&bndhp[1],errhp,2,(dvoid *)input,
(sb4) sizeof(OCIString *), SQLT_VST, (dvoid *)0,
(ub2 *) 0,(ub2 *) 0,(ub4) 0,(ub4 *)0,OCI_DEFAULT)) != OCI_SUCCESS) {
chk_err(errhp,ret,__LINE__,(OraText *)"OCIBindByPos");
return OCI_ERROR;
}


ret = OCIStmtExecute(svchp, stmthp, errhp, 1, 0, (OCISnapshot *) NULL,
(OCISnapshot *) NULL, OCI_DEFAULT);
chk_err(errhp,ret,__LINE__,(OraText *)"OCIStmtExecute");

//the execute returns -1

i don't know how to get the value after the execution of the stmt.

i have tried to do an iterator

sb4 index=0;
boolean exist;
dvoid *elem;
dvoid *elemind;
text *text_ptr;
OCIArray *lista;

printf("%s\n",text_ptr);

OCIString *client_elem=NULL;

OCICollGetElem (envhp,errhp,coll,(sb4)1,&exist,elem,&elemind);

client_elem = (OCIString *)elem;

printf("%s\n",&client_elem );

text_ptr=OCIStringPtr(envhp,client_elem);

printf("%s\n",text_ptr);

checkerr1(errhp,ret);


OCIIter *iterator;

OCIString *elem;

OCIInd *elemind;
text *text_ptr;
OCIString *client_elem;
OCIArray *clients;
boolean eoc;

clients[0]="sss";
clients[1]="gggg";


ret=OCIIterCreate(envhp,errhp,clients,&iterator);

ret=OCIIterNext(envhp,errhp,iterator,&elem,(dvoid* *)&elemind,&eoc);

client_elem = *(OCIString **) elem;

text_ptr=OCIStringPtr(envhp,client_elem);

printf("%s\n",text_ptr);

please help
thank you in advance