Re: Need help with OCIDescribeAny()

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 2 Dec 2004 09:38:47 -0800
Message-ID: <92eeeff0.0412020938.41ed2df_at_posting.google.com>


comic_rage_at_yahoo.com (comcrage) wrote in message news:<ab5d8404.0412011220.2704d1f9_at_posting.google.com>...
> 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
>
> }

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 Received on Thu Dec 02 2004 - 18:38:47 CET

Original text of this message