Selecting a LOB Column into a LONG Buffer Using a Simple Fetch

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

Selecting a LOB Column into a LONG Buffer Using a Simple Fetch

The following example illustrates selecting a LOB column using a simple fetch:

void simple_fetch()

{

word i, buf1 = 0;

word retval;

text buf[15000];

text *selstmt = (text *) "SELECT AD_SOURCETEXT FROM PRINT_MEDIA WHERE PRODUCT_ID = 2004";

OCIStmtPrepare(stmthp, errhp, selstmt, (ub4)strlen((char *)selstmt),

(ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);

retval = OCIStmtExecute(svchp, stmthp, errhp, (ub4) 0, (ub4) 0,

(const OCISnapshot*) 0, (OCISnapshot*) 0,

(ub4) OCI_DEFAULT);

while (retval == OCI_SUCCESS || retval == OCI_SUCCESS_WITH_INFO)

{

OCIDefineByPos(stmthp, &defhp[1], errhp, (ub4) 2, (dvoid *) buf,

(sb4) sizeof(buf1), (ub2) SQLT_CHR, (dvoid *) 0,

(ub2 *) 0, (ub2 *) 0, (ub4) OCI_DEFAULT);

retval = OCIStmtFetch(stmthp, errhp, (ub4) 1,

(ub4) OCI_FETCH_NEXT, (ub4) OCI_DEFAULT);

if (retval == OCI_SUCCESS || retval == OCI_SUCCESS_WITH_INFO)

DISCARD printf("buf = %.*s\n", buf2);

}

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航