Home » Developer & Programmer » Precompilers, OCI & OCCI » Error in OCINumberToReal
Error in OCINumberToReal [message #132844] |
Tue, 16 August 2005 07:39 |
Olga Plisenko
Messages: 2 Registered: September 2004
|
Junior Member |
|
|
Hi,
I'm creating the program for Oracle 9i(win2003) and am using Visual C++ 7.1 with OCI
to access Oracle database.
In one function i execute SQL query and get the returning value OCINumber type. After that,
i'm trying to convert this value to real with OCINumberToReal and here i get error OCI-22060.
Does anybody have such problem?
Help, please!
Here, source code of my function.
CRect *CVirtualMap::DefineLayerExtent(struct DescribeLayer *LayerDef)
{
sword status;
OCIParam *ParamDp;
char NameTabUp[100],DimName[64];
OCINumber sdo_ub,sdo_lb, sdo_tool;
double sdo_lb_d,sdo_ub_d,sdo_tool_d;
OCIString *sdo_dimname=(OCIString *)0;
static text *SQLText = (text *)"SELECT p.sdo_lb \
FROM USER_SDO_GEOM_METADATA e, TABLE(e.diminfo) p where e.table_name=:nametab";
static text *NameTab;
OCIStmt *Statement=(OCIStmt*)0;
OCIDefine *DefineHp = (OCIDefine *) 0;
OCIBind *BindStmt = (OCIBind *) 0;
COCIEnvironment *Env;
CRect Ext;
Env=Conn->Env;
//--------------------------------------
// Name of table, layer
int l=strlen(LayerDef->Name);
NameTab = (text *)malloc((int)l+1);
strcpy((char *)NameTab,LayerDef->Name);
strupr((char *)NameTab);
OCINumberSetZero(Env->Error,&sdo_lb);
Env->CheckErr(Env->Error,-1);
// handle SQL Statement
Env->CheckErr(Env->Error, OCIHandleAlloc( (dvoid *) Env->OrEnv, (dvoid **) &Statement,
OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
// prepare SQL Statement
Env->CheckErr(Env->Error, OCIStmtPrepare(Statement, Env->Error, SQLText,
(ub4) strlen((char *)SQLText),
(ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
// Bind input variable
Env->CheckErr(Env->Error,OCIBindByName(Statement, &BindStmt, Env->Error, (text *) ":nametab",
8, (dvoid *) NameTab,(ub4)strlen((char *)NameTab)+1,
SQLT_STR, (dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0,
(ub4 *) 0, OCI_DEFAULT));
// Bind output variable
Env->CheckErr(Env->Error, OCIDefineByPos(Statement, &DefineHp, Env->Error, 1,
(dvoid *)&sdo_lb,(sb4)22, SQLT_NUM, // sizeof(OCINumber), SQLT_NUM,
(dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT));
// execute SQL Statement
Env->CheckErr(Env->Error, OCIStmtExecute(Env->Context, Statement,
Env->Error, (ub4)0, (ub4) 0,(CONST OCISnapshot *) NULL,
(OCISnapshot *) NULL, OCI_DEFAULT));
do
{
status=OCIStmtFetch2(Statement,Env->Error,(ub4)1,OCI_DEFAULT,(ub4)0, OCI_DEFAULT);
Env->CheckErr(Env->Error,status);
if(status == 0)
{
status= OCINumberToReal(Env->Error, (CONST OCINumber *)&sdo_lb,
(uword) sizeof(sdo_lb_d), (dvoid *) &sdo_lb_d);
Env->CheckErr(Env->Error,status);
}
}while(status !=OCI_NO_DATA);
/* free memory */
OCIHandleFree((dvoid *)Statement, (ub4) OCI_HTYPE_STMT);
return &Ext;
}
Thanks in advance.
Olga.
[Updated on: Wed, 17 August 2005 00:23] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Jan 02 21:14:33 CST 2025
|