Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Correct way to close OCI handles

Correct way to close OCI handles

From: John Savill <john_at_savilltech.com>
Date: Thu, 12 Oct 2000 18:38:19 +0100
Message-ID: <8s4stb$qmd$1@lure.pipex.net>

Hi,

I have an OCI handle which I reuse for different SQL statements (for example)

checkerr(errhp, OCIStmtPrepare(stmthp, errhp, tempSQL,

(ub4) strlen((char *) tempSQL),
(ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));

      //check number of records updated
      checkerr(errhp,

OCIAttrGet(stmthp,OCI_HTYPE_STMT,&nrows,0,OCI_ATTR_ROW_COUNT,errhp));
      status = OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1, (ub4) 0,
            (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);

      if(nrows!=1) //if have not updated the audit trail
     printf("There was a problem updating the audit trail\n");

      checkerr(errhp, OCIStmtPrepare(stmthp, errhp, tempSQLSysLog,

(ub4) strlen((char *) tempSQLSysLog),
(ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
//check number of records updated checkerr(errhp,

OCIAttrGet(stmthp,OCI_HTYPE_STMT,&nrows,0,OCI_ATTR_ROW_COUNT,errhp));
      status = OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1, (ub4) 0,
            (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);

      if(nrows!=1) //if have not updated the audit trail
     printf("There was a problem updating the system log\n");


Should I be "closing" the stmthp before reusing it?

Thanks,

John Received on Thu Oct 12 2000 - 12:38:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US