Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help with OCIDescribeAny()

48 views
Skip to first unread message

comcrage

unread,
Dec 1, 2004, 3:20:42 PM12/1/04
to
Hi,

I've been having problems gettings OCIDescribeAny to work. I got my
code from Visual C++ to connect successfully to the Oracle database
8.0. I want to check and call a stored procedure. After I login, I use
the OCIDescribeAny with the name of stored procedure passed as 1 of
the arguements, but it always return an error stating that the stored
procedure object does not exist. The stored procedure is verifed and
is part of a package. I tried passing both the sp_name and
package_name.sp_name, but the same errors comes back. I even tried
using the OCI_DescribeAny on a table_name, but the same error returns.
Any help is greatly appeciated.

Thanks,

Rage


OCIEnv *p_env;
OCIError *p_err;
OCISvcCtx *p_svc;
OCIStmt *p_sql;
OCIBind *p_bnd;
OCIDescribe* p_desc;

int COraOCI::test()

{

int rc = 0;
int v_val[4] = {1, 91, 57, 12};

char* v_usr = "phureporter";
char* v_pwd = "phureporter";
char* v_tns = "testphu";

char* v_sql = "BEGIN DCL_VALIDATION_PKG.GET_ENROLLEE_INFO(:x, );
END;";

ub4 v_val_cnt = 4;


rc = OCIInitialize((ub4) OCI_OBJECT, (dvoid *)0,
(dvoid * (*)(dvoid *, size_t)) 0,
(dvoid * (*)(dvoid *, dvoid *, size_t))0,
(void (*)(dvoid *, dvoid *)) 0 );
error(rc);

rc = OCIEnvInit( (OCIEnv **) &p_env, OCI_DEFAULT, (size_t) 0,
(dvoid **) 0 );
error(rc);

rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_err,
OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0);
error(rc);

rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_svc,
OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0);
error(rc);

rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_sql,
OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0);
error(rc);

rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_desc,
OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0);

rc = OCILogon(p_env, p_err, &p_svc, (OraText *) v_usr,
strlen(v_usr),
(OraText *) v_pwd, strlen(v_pwd), (OraText *) v_tns,
strlen(v_tns));
error(rc);



text objptr[] = "DCL_VALIDATION_PKG.GET_VEHICLE_INFO";
ub4 objp_len = strlen("DCL_VALIDATION_PKG.GET_VEHICLE_INFO");

rc = OCIDescribeAny(p_svc, p_err, objptr, objp_len, OCI_OTYPE_NAME,
OCI_DEFAULT, OCI_PTYPE_PROC, p_desc);


error(rc); // The error always returns a -1 for rc to pass to the
error function

}

rs_a...@hotmail.com

unread,
Dec 2, 2004, 8:20:41 AM12/2/04
to
You should use OCI_PTYPE_PKG for describing packages.... OCI_PTYPE_PROC
is for standalone procedures. Secondly, I don't think your code will
work because you cannot do describe on packaged
procedures/functions.... they are part of the package. Try again by
using OCI_PTYPE_PKG with just the package name.

Regards
/Rauf

Rauf Sarwar

unread,
Dec 2, 2004, 12:38:47 PM12/2/04
to
comic...@yahoo.com (comcrage) wrote in message news:<ab5d8404.04120...@posting.google.com>...

You should use OCI_PTYPE_PKG for describing packages.... OCI_PTYPE_PROC

0 new messages