当表中只有一列blob时,查询出来的是乱码[code=c][/c#include "ocilib.h"#define SIZE_BUF 512int main(void)
{
OCI_Connection *cn;
OCI_Statement *st;
OCI_Resultset *rs;
OCI_Lob *lob1, *lob2; char temp[SIZE_BUF+1];
int code, n; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT))
return EXIT_FAILURE; cn = OCI_ConnectionCreate("ora11g", "u1", "u1", OCI_SESSION_DEFAULT);
st = OCI_StatementCreate(cn);
OCI_ExecuteStmt(st, "select dbms_lob.substr(c0,32767)||chr(1)||dbms_lob.substr(c1,32767) from test_blob5"); rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{ printf(" action : %s \n", OCI_GetString(rs,1) );
} printf("\n%d row(s) fetched\n", OCI_GetRowCount(rs)); OCI_Cleanup(); return EXIT_SUCCESS;
}ode]
{
OCI_Connection *cn;
OCI_Statement *st;
OCI_Resultset *rs;
OCI_Lob *lob1, *lob2; char temp[SIZE_BUF+1];
int code, n; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT))
return EXIT_FAILURE; cn = OCI_ConnectionCreate("ora11g", "u1", "u1", OCI_SESSION_DEFAULT);
st = OCI_StatementCreate(cn);
OCI_ExecuteStmt(st, "select dbms_lob.substr(c0,32767)||chr(1)||dbms_lob.substr(c1,32767) from test_blob5"); rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{ printf(" action : %s \n", OCI_GetString(rs,1) );
} printf("\n%d row(s) fetched\n", OCI_GetRowCount(rs)); OCI_Cleanup(); return EXIT_SUCCESS;
}ode]
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货