Oracle VarChar for ADO Output Parameter
I have a VB6 app on XP that uses OLE DB and ADO to access data from Oracle. I am trying to create and append and output parameter to my SQL command. The output parameter is of type VarChar in Oracle. I tried to choose adChar, adVarChar, adLongVarChar for this Output parameter type, but I keep getting "3708 Parameter object is imoproperly defined." error.
What should be right mapping from ADO's DataTypeEnum to Oracle's VarChar???
I'm not up on the latest, but, the last time I looked at it, we were supposed to use VARCHAR2, not VARCHAR.
Anyhow, I use VB6 and ADO all the time ... usually with MSDAORA or ODBC, but, regardless, I use adVarChar and have never had a problem with it. You might check to make sure your Size is big enough. I usually just use 255 for Size. I haven't used an OUT parameter in a while, but you might try initialized your parameter value to String(" ", 255) or the like.
Good luck.
Similar Messages
-
What's the Oracle Standard for generating Output & logfile for Conc Prog?
Is there any Oracle Standard for generating output and log files for standard concurrent programs and reports.
for example: if Error, only Log no output
if Warning, Log & output
Complete Normal, Log & output
Any help is appreciated...
Thanks,
SubhadeepIs there any Oracle Standard for generating output and log files for standard concurrent programs and reports.
for example: if Error, only Log no output
if Warning, Log & output
Complete Normal, Log & output
Any help is appreciated...APPS.FND_CONCURRENT -- procedure get_dev_phase_status
http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_details?c_name=FND_CONCURRENT&c_owner=APPS&c_type=PACKAGE%20BODY&c_detail_type=source
Thanks,
Hussein -
Getting error while Calling Oracle Stored Procedure with output Parameter
HI All,
From long days i am working on this but i unable to solve it.
Even i have studied so many forums in SAP but i didn't find the solution.
I am calling Oracle Store procedure with 3 inputs and 1 output without cursor.
Store Procedure:-
CREATE OR REPLACE PROCEDURE PDS.send_rm
IS
proc_name VARCHAR2(64) := 'send_rm';
destination_system VARCHAR2(32) := 'RAWMAT';
xml_message VARCHAR2(4000);
status_code INTEGER;
status_message VARCHAR2(128);
debug_message VARCHAR2(128);
p_ret INTEGER;
BEGIN
DBMS_OUTPUT.PUT_LINE( proc_name || ' started' );
xml_message := '<RAW_MATERIAL>'||
'<BAR_CODE>10000764601</BAR_CODE>'||
'<MATERIAL>1101448</MATERIAL>'||
'<VENDOR_CODE/>'||
'<PRODUCTION_DATE>0000-00-00</PRODUCTION_DATE>'||
'<EXPIRE_DATE>0000-00-00</EXPIRE_DATE>'||
'<BATCH/>'||
'<PO_NUM/>'||
'<MATERIAL_DESCRIPTION>POWER SUPPLY</MATERIAL_DESCRIPTION>'||
'<SPEC_NAME/>'||
'<STOCK_CODE>BSW-JH</STOCK_CODE>'||
'<INSPECTION_LOT>00</INSPECTION_LOT>'||
'<USAGE_DECISION_CODE/>'||
'<MATERIAL_GROUP>031</MATERIAL_GROUP>'||
'</RAW_MATERIAL>';
dbms_output.put_line('XML '||xml_message);
-- vp_interface.load_rawmat@cnprpt1_pds(SYSDATE, destination_system,
-- xml_message, p_ret);
vp_interface.load_rawmat(SYSDATE, destination_system,
xml_message, p_ret);
dbms_output.put_line('Return Code '||p_ret);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
status_code := SQLCODE;
status_message := SUBSTR(SQLERRM, 1, 64);
-- Extract_Error_Logger(proc_name, 'LOCAL', SYSDATE, -999,
-- status_message, 0, debug_message);
ROLLBACK;
END send_rm;
And while i am calling this Store procedure in MII, I am facing error.
I have tried different ways but didnt solved
In SQL Query, i kept mode as: FixedQueryOutput
Can anyone tell me or send code for calling above store procedure
And onemore thing, While creating store procedure in Oracle for MII. Do we need to Create output parameter as cursor or normal.
Thanks,
Kind Regards,
Praveen Reddy MHi Praveen
Our wrapper was created because we could not modify the procedure we call (it was not returning a cursor).
CREATE OR REPLACE PROCEDURE CHECK_PUT_IN_USE
(STRCMPNAME in varchar2,
STRSCANLABEL in varchar2,
RCT1 out SYS_REFCURSOR
AS
charDispo Char(1);
charStatus Char(1);
intCatNo Integer;
charCatDispo Char(1);
strCatQual VarChar2(2);
strCatDesc VarChar2(30);
strMsg VarChar2(128);
BEGIN
qa.check_put_in_use@AR(STRCMPNAME,
STRSCANLABEL,
charDispo,
charStatus,
intCatNo,
charCatDispo,
strCatQual,
strCatDesc,
strMsg);
OPEN RCT1
FOR Select charDispo,charStatus,charDispo,charStatus,intCatNo,charCatDispo,strCatQual,strCatDesc,strMsg from Dual;
END;
Hope this helps
Regards
Amrik
then with a FixedQueryWithOutput
call mixar.qasap.wrapper_update_put_in_use('[Param.1]','[Param.2]',[Param.3],?)
Hope this helps. -
Calling an oracle stored procedure with output parameter
Hi,
I am trying to execute a procedure with 2 input and 1 output parameters by using SQLQuery. I tried each mode (Command, FixedQuery & FixedQueryWithOutput) with following statements.
call cm_test_prod([Param.1],[Param.2],[Param.3])
Error:"missing expression "
call cm_test_prod([Param.1],[Param.2],?)
Error:"wrong number or types of arguments in call to 'CM_TEST_PROD'"
call cm_test_prod([Param.1],[Param.2],:var)
Error:"wrong number or types of arguments in call to 'CM_TEST_PROD' "
or
Error: "not all variables bound"
If I use without output parameter, in Command mode, It works fine.
call cm_test_prod([Param.1],[Param.2])
or
call cm_test_prod('[Param.1]','[Param.2]')
works without error.
SAP XMII: Version 12.0.5 Build(126)
Oracle 10G
Any help would be greatly appreciated.
Thanks,
Tunur.
Edited by: Namik Tunur on Dec 14, 2010 3:34 PM
Edited by: Namik Tunur on Dec 14, 2010 3:36 PMHi,
@Marcelo,
I used your package just by replacing 'varchar2' instead of 'varchar(100)''. I got the error message 'ORA-00900: invalid SQL statement'. I didn't understand how we handle output parameter with this:
Query = Call MYPKG.MyProcedure(1,'Test FixedQueryWithOutput',?)
What is Query in here? If we have two output parameters, how would we get the outputs?
My procedure is:
CREATE OR REPLACE
PROCEDURE XXXXX.CM_TEST_PROD_OUTPUT(v1 in number,v2 in number, v3 out number) IS
BEGIN
update test_table set no2 = (v1+v2);
commit;
v3 := v1+v2;
END;
declare
a number;
BEGIN
cm_test_prod_output(1,6,a);
END;
if I use this
call cm_test_prod_output([Param.1],[Param.2],?)
with FixedQueryWithOutput mode,
I get the following error:
ORA-06553: PLS-306: wrong number or types of arguments in call to 'CM_TEST_PROD_OUTPUT'
@Mike,
I already tried both with quotes and without quotes, also I tried both with number output and with string output.
As I mentioned before, if I use number inputs without output in Command mode,
call cm_test_prod(http://Param.1,http://Param.2)
or
call cm_test_prod('http://Param.1','http://Param.2')
works succesfully.
Regards,
Tunur -
How to use Oracle refcursor dataset output parameter from SP
Can I request for help on how to use Oracle Output parameter from a stored procedure as a source. I need the output tobe stored in a flat file
Thanks
Abhijit
Message was edited by:
Abhijit77yes I would like to use it for ODI.. I would like the ouput of the refcursor to be fed to a text file using ODI. How to handle the records returned by the refcursor and map with txt file.
-
URGENT: CLOB as output parameter for stored proc
HELP
I am unable to execute a stored procedure which has a CLOB defined as an output parameter from my Java code. It executes just fine from the SQL Plus promt.
When I try to run it through JDBC I get a PLS-00306 error.
I am using the Thin JDBC driver. When I try to compile using the OCI driver, I get class not found compile errors trying to import oracle.sql.*.
Thanks!
Donna J. PolkThe oracle.sql.* classes are part of the Oracle JDBC Driver.
Update your CLASSPATH variable to include $ORACLE_HOME/jdbc/lib/classes12_01.zip for JDK 1.2 or $ORACLE_HOME/jdbc/lib/classes111.zip for JDK 1.1.x -
How to check for null value of output parameter?
Hi guys, I get a test procedure with 2 output parameters and do nothing:
CREATE OR REPLACE PACKAGE BODY p_parameters_test AS
PROCEDURE p_null_output_basetype(p1 OUT NUMBER,p2 OUT VARCHAR2)
AS
BEGIN
DBMS_OUTPUT.PUT_LINE('DO NOTHING');
END p_null_output_basetype;
END;And I have below C# code:
cmd.CommandText = "p_parameters_test.p_null_output_basetype";
OracleParameter p1 = new OracleParameter("p1", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
OracleParameter p2 = new OracleParameter("p2", OracleDbType.Varchar2, System.Data.ParameterDirection.Output);
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
try
conn.Open();
cmd.ExecuteNonQuery();
if (p1.Value==null)
Console.WriteLine("p1.Value==null");
else if (Convert.IsDBNull(p1.Value))
Console.WriteLine("Convert.IsDBNull(p1.Value)");
else
Console.WriteLine("p1 else "+p1.Value);
if (p2.Value==null)
Console.WriteLine("p2.Value==null");
else if (Convert.IsDBNull(p2.Value))
Console.WriteLine("Convert.IsDBNull(p2.Value)");
else
Console.WriteLine("p2 else "+p2.Value);
Console.WriteLine("finished");
catch......The output of it is:
p1 else null
p2 else null
Does anyone have any idea why it always goes to the 'else' of the condition-branching, and how can I check if the output parameter is null?
Thanks in advance.Morven... I ran into similar problems. Maybe you've found a solution of your own by now, but here's what I've learned...
The Value property of output parameters, like p1 and p2 in your code, actually varies, according to (I think) the OracleDbType of the parameter. You've got OracleDbType.Decimal for p1 and OracleDbType.Varchar2 for p2. These look about right, since they match the parameter types in your actual stored procedure.
After cmd.ExecuteNonQuery() executes, the respective Value properties of p1 and p2 are actually of different types. For p1, it's going to be "OracleDecimal" and for p2 it's "OracleString". Keep in miind that these are the types of the Value property of the OracleParameter objects, not the OracleParameter objects themselves.
OracleDecimal and OracleString (and some other types like OracleDate, etc.) have an "IsNull" property you can use if you cast the Value property to its runtime type...
if ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull) { …do something… }
else { …do something else… }
Or maybe something like this...
Decimal p1val = ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull ? 0 : ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value;
I'll admit that expressions like this: ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value look a little weird. But the "Value" of the "OracleDecimal" property is a regular .NET decimal type (System.Decimal). So, it's a "Value" of the "Value" property of the OracleParameter class.
Even when the stored procedure returns a null, the Value property is still populated. In the case of p1, it's populated with an OracleDecimal object (actually a struct) where IsNull is true. That's why "p1.Value==null" tests false.
From what I can see, OracleDecimal, OracleString, etc. will never be typed as DbNull, or DBNull.Value. So, that would be why Convert.IsDBNull(p1.Value)) always returns false. btw, it appears that these are Value types. That would suggest that coding something like like this, should be avoided…
OracleString p2val = ((OracleString)cmd.Parameters["p2"].Value;
if (p2val.IsNull) { …do something… }
else { …do something else… }
By assigning the value to another variable, you’d be actually creating an entire copy of the OracleString structure, which is pointless.
I hope that helps
Edited by: 897674 on Jan 3, 2012 10:44 AM
Edited by: 897674 on Jan 3, 2012 10:46 AM -
OUTPUT parameter for even handler
Hi,
Does any body know why Forte doesn't allow OUTPUT parameter type for even
handler?
Thank you,
Minh Le,
Software Engineer
Mercury Interactive Corp.See the example in this recent posting. To get data from a subpanel, use Get Control Value or Get Control Value [Variant].
-
How to call a Stored Procedure with a REF CURSOR output parameter
I am looking forward an example that call a stored function/procedure with a REF CURSOR output parameter and get the result.
In other words, I have a stored function/procedure that execute a SELECT statement using the OCI library and then it could get the values of each column and each row.
I put a code snippet, it have only the main thing to call a simple stored procedure and print the name of each column of the cursor, but I couldn´t to print out the values in the table that call the stored procedure.
I understand that the next step, it is to call a OCIStmtFetch.
How to associate the cursor with the OCIStmtFetch?
If you need more information, only tell me.
I am using ANSI C with HP-UX Operative System (C for HP-UX) and Oracle 10g.
Regards.
Antonio Garcia
/* callOracleSP */
#include <stdio.h>
#include <string.h>
#include <oci.h>
#include <stdlib.h>
char* pConnectChar ="server";
char* pUsernameChar = "user";
char* pPasswordChar = "passwd";
char* sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
int retval;
ub4 parmcnt=0;
ub4 pos2=0;
text *pcoln[20];
ub4 namelen[20];
char state_key[5];
OCIStmt* pOciStatement;
OCIStmt* pOciStatCursor;
OCIError* pOciError;
OCIEnv* pOciEnviron;
OCIServer* pOciServer;
OCISession* pOciSession;
OCISvcCtx* pOciServiceContext;
OCIBind* pOciBind[500];
OCIParam* pOciParam;
int main()
retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
(unsigned char *)pConnectChar,strlen(pConnectChar));
printf("OCILogon retval=%d\n",retval);
retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
OCI_NTV_SYNTAX, OCI_DEFAULT);
printf("StmtPrepare retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
(sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
(sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
strcpy(state_key,"CA");
retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
(OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
printf("StmtExecute retval=%d\n",retval);
/* How to get the values of the cursor? */
/* Get number of parameters of the Cursor */
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
(ub4)OCI_ATTR_PARAM_COUNT, pOciError);
printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
for (int pos = 1; pos <= (int)parmcnt; pos++)
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
(ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,
(ub4) pos );
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &pcoln[pos-1],(ub4 *) &namelen[pos-1],
(ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
for (int i = 1; i <=(int)parmcnt; i++)
printf("Column %i\tNAME = %.*s\n",i,namelen[i-1],pcoln[i-1]);
return 0;
This is the script that create the table, insert records and create the stored procedure
CREATE TABLE CITIES (
STATE_CODE VARCHAR2(2) NULL,
CITY_CODE NUMBER(15,5) NULL,
CITY_NAME VARCHAR2(30) NULL
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 30, 'SAN DIEGO')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 40, 'SACRAMENTO')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('FL', 10, 'MIAMI')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('FL', 20, 'ORLANDO')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('NY', 10, 'NEW YORK')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('NY', 20, 'ALBANY')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 10, 'LOS ANGELES')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 20, 'SAN FRANCISCO')
CREATE OR REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
/* The following are T/SQL specific global variables. */
TYPE RCT1 IS REF CURSOR;/*new weak cursor definition*/
END globalPkg;
CREATE OR REPLACE PROCEDURE SP_ADDCITY(
P_STATE_CODE IN VARCHAR,
P_CITY_CODE IN NUMBER,
P_CITY_NAME IN VARCHAR2,
P_RETURN IN OUT NUMBER)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
BEGIN
StoO_rowcnt := 0;
StoO_error := 0;
StoO_selcnt := 0;
P_RETURN := 0;
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
StoO_rowcnt := SQL%ROWCOUNT;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
StoO_rowcnt := 2;
WHEN OTHERS THEN
StoO_rowcnt := 0;
StoO_selcnt := 0;
StoO_error := SQLCODE;
StoO_errmsg := SQLERRM;
IF StoO_error != 0 THEN
BEGIN
P_RETURN := 1;
RETURN;
END;
END IF;
END;
CREATE OR REPLACE PROCEDURE SP_GETCITIES(
STATE_KEY IN VARCHAR,
RC1 IN OUT globalPkg.RCT1)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
BEGIN
StoO_rowcnt := 0;
StoO_error := 0;
StoO_selcnt := 0;
OPEN RC1 FOR
SELECT STATE_CODE, CITY_CODE, CITY_NAME
FROM CITIES
WHERE STATE_CODE = STATE_KEY
ORDER BY CITY_CODE;
StoO_rowcnt := SQL%ROWCOUNT;
EXCEPTION
WHEN OTHERS THEN
StoO_rowcnt := 0;
StoO_error := SQLCODE;
StoO_errmsg := SQLERRM;
END;
/Hi Mark,
Thanks for your recommendations.
I change the code with OCIDefineByPos, one for each parameter from cursor and then use the OCIStmtFetch.
I don´t receive a error when call OCIDefineByPos, but when I call OCIStmtFetch receive a -1 error number.
What is wrong with the code?
The script is the same.
I need your help!
Best Regards!
Antonio Garcia (Mexico)
This the new code:
#include <stdio.h>
#include <string.h>
#include <oci.h>
#include <stdlib.h>
char* pConnectChar ="ORAC617";
char* pUsernameChar = "C617_005_DBO_01";
char* pPasswordChar = "Tempora1";
char* sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
int retval;
ub4 parmcnt=0;
ub4 pos2=0;
sb2 *c_indp;
text *pcoln[20], *name,*name2;
ub4 namelen[20],len;
ub2 type,size;
char state_key[5];
OCIDefine *pdef;
OCIBind *p_bnd;
ub1 **c_buf;
OCIStmt* pOciStatement; /* Statement handle */
OCIStmt* pOciStatCursor; /* Statement handle */
OCIError* pOciError; /* Error handle */
OCIEnv* pOciEnviron; /* Environment handle */
OCIServer* pOciServer; /* Server handle */
OCISession* pOciSession; /* Session handle */
OCISvcCtx* pOciServiceContext; /* Service Context handle */
OCIBind* pOciBind[500]; /* Bind handle */
OCIParam* pOciParam; /* Param handle */
int OCI_Fetch(OCIStmt *p_select,OCIError *p_err, int *piOcc)
int iOcc, rc;
rc=OCIStmtFetch(p_select,p_err,1,OCI_FETCH_NEXT,OCI_DEFAULT);
printf("rc fetch %i",rc);
if(rc==0&&piOcc!=NULL){
printf("entro al if");
iOcc=*piOcc;
*piOcc=iOcc+1;
return rc;
int main()
int pos,i=0,rc;
retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
printf("EnvCreate retval=%d\n", retval);
retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
printf("EnvInit retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
printf("HandleAlloc OCI_HTYPE_ERROR retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
printf("HandleAlloc OCI_HTYPE_SVCCTX retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
(unsigned char *)pConnectChar,strlen(pConnectChar));
printf("OCILogon retval=%d\n",retval);
retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
OCI_NTV_SYNTAX, OCI_DEFAULT);
printf("StmtPrepare retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
(sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
(sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
strcpy(state_key,"CA");
retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
(OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
printf("StmtExecute retval=%d\n",retval);
c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
c_indp=(sb2 *)calloc(sizeof(sb2 *),3);
// Get number of parameters of the Cursor
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
(ub4)OCI_ATTR_PARAM_COUNT, pOciError);
printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
for (pos = 1; pos <= (int)parmcnt; pos++)
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
(ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,(ub4) pos );
// Get the column name
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &name,(ub4 *) &len, (ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
// Get the column datatype
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &type,(ub4 *)0,(ub4)OCI_ATTR_DATA_TYPE,(OCIError *)pOciError);
// Get the column size
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &size,(ub4 *)0,(ub4)OCI_ATTR_DATA_SIZE,(OCIError *)pOciError);
printf("Column %i\tNAME = %.*s \ttype %d \tsize %d\n",pos,len,name,type,size);
// OCIDefine ByPos, one for each parameter
// c_buf store the STATE_CODE, CITY_CODE and CITY_NAME columns from the cursor
rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);
printf("OCIDefineByPos retval=%d\n,rc);
// call OCIStmtFetch. In the next line, I receive the error
rc=OCIStmtFetch(pOciStatCursor,pOciError,1,OCI_FETCH_NEXT,OCI_DEFAULT);
printf("rc fetch %i",rc);
return 0;
{code} -
Error fetching data from a foxpro db using Oracle Gateway for ODBC
Hi.
I have an 10.2.0.1 database an a 11.2.0 Oracle Gateway for ODBC installed and configured.
The dblink test works fine, I can connect with the foxpro database because if I execute desc centros I can see the
columns of table centros.
The problem comes when I try to execute Select * from centros@fox1;
A syntax error is returned ([Microsoft][ODBC Visual FoxPro Driver]Syntax error. {42000,NativeErr = 200})
I paste down the output of the trace file with HS_FDS_TRACE_LEVEL=255
If I run select codcen from centros@fox1; another error is shown. Tell me if you want the other trace file.
select codcen from centros@fox1
ERROR en lÝnea 1:
ORA-00904: "CODCEN": identificador no vßlido
Oracle Corporation --- JUEVES MAY 31 2012 13:11:24.765
Heterogeneous Agent Release
11.2.0.1.0
Oracle Corporation --- JUEVES MAY 31 2012 13:11:24.750
Version 11.2.0.1.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "255"
Entered hgosdip
setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
setting HS_IDLE_TIMEOUT to default of 0
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "UCS2"
setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
setting HS_FDS_DATE_MAPPING to default of "DATE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
setting HS_FDS_SUPPORT_STATISTICS to default of "FALSE"
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
Default value of 32 assumed for HS_FDS_SQLLEN_INTERPRETATION
setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
setting HS_FDS_DELAYED_OPEN to default of "TRUE"
setting HS_FDS_WORKAROUNDS to default of "0"
Exiting hgosdip, rc=0
ORACLE_SID is "DAVID"
Product-Info:
Port Rls/Upd:1/0 PrdStat:0
Agent:Oracle Database Gateway for ODBC
Facility:hsa
Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:DAVID
Exiting hgogprd, rc=0
hostmstr: 2057416704: HOA After hoagprd
hostmstr: 2057416704: HOA Before hoainit
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=178
HOCXU_DRV_NCHAR=1000
HOCXU_DB_CSET=178
HOCXU_SEM_VER=102000
Entered hgolofn at 2012/05/31-13:11:25
Exiting hgolofn, rc=0 at 2012/05/31-13:11:25
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
Invalid value of 32 given for HS_FDS_SQLLEN_INTERPRETATION
treat_SQLLEN_as_compiled = 1
Exiting hgoinit, rc=0 at 2012/05/31-13:11:25
hostmstr: 2057416704: HOA After hoainit
hostmstr: 2057416704: HOA Before hoalgon
Entered hgolgon at 2012/05/31-13:11:25
reco:0, name:SYSTEM, tflag:0
Entered hgosuec at 2012/05/31-13:11:25
Exiting hgosuec, rc=0 at 2012/05/31-13:11:25
HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
using SYSTEM as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
Entered hgocont at 2012/05/31-13:11:25
HS_FDS_CONNECT_INFO = "Prueba_Foxpro"
RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
Entered hgogenconstr at 2012/05/31-13:11:25
dsn:Prueba_Foxpro, name:SYSTEM
optn:
Entered hgocip at 2012/05/31-13:11:25
dsn:Prueba_Foxpro
Exiting hgocip, rc=0 at 2012/05/31-13:11:25
##>Connect Parameters (len=39)<##
## DSN=Prueba_Foxpro;
#! UID=SYSTEM;
#! PWD=*
Exiting hgogenconstr, rc=0 at 2012/05/31-13:11:25
Entered hgopoer at 2012/05/31-13:11:26
hgopoer, line 233: got native error 0 and sqlstate 01000; message follows...
[*Microsoft][Administrador de controladores ODBC] El controlador no admite una versión de ODBC distinta de la que la necesita la aplicación (vea SQLSetEnvAttr)*. {01000}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:26
hgocont, line 2686: calling SqlDriverConnect got sqlstate 01000
Entered hgolosf at 2012/05/31-13:11:26
ODBC Function-Available-Array 0xFFFE 0x00FF 0xFF00 0xAA7F 0x03B3 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x0000 0x0000 0xEE00 0x395C
Exiting hgolosf, rc=0 at 2012/05/31-13:11:26
DriverName:VFPODBC.DLL, DriverVer:06.86.0001
DBMS Name:Visual FoxPro, DBMS Version:03.00.0000
Exiting hgocont, rc=0 at 2012/05/31-13:11:26 with error ptr FILE:hgocont.c LINE:2686 ID:SQLDriverConnect
Entered hgopoer at 2012/05/31-13:11:26
hgopoer, line 233: got native error 0 and sqlstate HYC00; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Driver not capable {HYC00}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:26
hgolgon, line 795: calling SQLGetInfo got sqlstate HYC00
SQLGetInfo returns N for SQL_CATALOG_NAME
Exiting hgolgon, rc=0 at 2012/05/31-13:11:26 with error ptr FILE:hgolgon.c LINE:795 ID:GetInfo: Support catalogs
hostmstr: 2036506624: HOA After hoalgon
RPC Calling nscontrol(0), rc=0
hostmstr: 2036506624: RPC Before Upload Caps
hostmstr: 2036506624: HOA Before hoaulcp
Entered hgoulcp at 2012/05/31-13:11:26
Entered hgowlst at 2012/05/31-13:11:26
Exiting hgowlst, rc=0 at 2012/05/31-13:11:26
SQLGetInfo returns 0x0 for SQL_OWNER_USAGE
TXN Capable:1, Isolation Option:0x2
SQLGetInfo returns 0 for SQL_MAX_SCHEMA_NAME_LEN
SQLGetInfo returns 128 for SQL_MAX_TABLE_NAME_LEN
SQLGetInfo returns 0 for SQL_MAX_PROCEDURE_NAME_LEN
SQLGetInfo returns ` (0x60) for SQL_IDENTIFIER_QUOTE_CHAR
SQLGetInfo returns Y for SQL_COLUMN_ALIAS
16 instance capabilities will be uploaded
capno:1964, context:0x00000000, add-info: 0
capno:1989, context:0x00000000, add-info: 0
capno:1991, context:0x0001ffff, add-info: 0
capno:1992, context:0x0001ffff, add-info: 1, translation:"`"
capno:3042, context:0x00000000, add-info: 0, translation:"42"
capno:3047, context:0x00000000, add-info: 0, translation:"57"
capno:3049, context:0x00000000, add-info: 0, translation:"59"
capno:3050, context:0x00000000, add-info: 0, translation:"60"
capno:3066, context:0x00000000, add-info: 0
capno:3067, context:0x00000000, add-info: 0
capno:3068, context:0x00000000, add-info: 0
capno:3069, context:0x00000000, add-info: 0
capno:3500, context:0x00000001, add-info: 91, translation:"42"
capno:3501, context:0x00000001, add-info: 93, translation:"57"
capno:3502, context:0x00000001, add-info: 107, translation:"59"
capno:3503, context:0x00000001, add-info: 110, translation:"60"
Exiting hgoulcp, rc=0 at 2012/05/31-13:11:26
hostmstr: 2036506624: HOA After hoaulcp
hostmstr: 2036506624: RPC After Upload Caps
hostmstr: 2036506624: RPC Before Upload DDTR
hostmstr: 2036506624: HOA Before hoauldt
Entered hgouldt at 2012/05/31-13:11:27
NO instance DD translations were uploaded
Exiting hgouldt, rc=0 at 2012/05/31-13:11:27
hostmstr: 2036506624: HOA After hoauldt
hostmstr: 2036506624: RPC After Upload DDTR
hostmstr: 2036506624: RPC Before Begin Trans
hostmstr: 2036506624: HOA Before hoabegn
Entered hgobegn at 2012/05/31-13:11:27
tflag:0 , initial:1
hoi:0x12f094, ttid (len 54) is ...
00: 54455354 2E524547 52455353 2E524442 [TEST.REGRESS.RDB]
10: 4D532E44 45562E55 532E4F52 41434C45 [MS.DEV.US.ORACLE]
20: 2E434F4D 2E663033 63383037 372E392E [.COM.f03c8077.9.]
30: 34342E37 3735 [44.775]
tbid (len 10) is ...
0: 09002C00 07030000 0104 [..,.......]
Exiting hgobegn, rc=0 at 2012/05/31-13:11:27
hostmstr: 2036506624: HOA After hoabegn
hostmstr: 2036506624: RPC After Begin Trans
hostmstr: 2036506624: RPC Before Describe Table
hostmstr: 2036506624: HOA Before hoadtab
Entered hgodtab at 2012/05/31-13:11:27
count:1
table: CENTROS
Entered hgopdsc at 2012/05/31-13:11:27
Describing procedure CENTROS
Output hoada
hgopdsc, line 1426: NO hoada to print
Exiting hgopdsc, rc=942 at 2012/05/31-13:11:27
The hoada for table CENTROS follows...
hgodtab, line 904: NO hoada to print
Exiting hgodtab, rc=0 at 2012/05/31-13:11:27
hostmstr: 2036506624: HOA After hoadtab
hostmstr: 2036506624: RPC After Describe Table
hostmstr: 2036506624: RPC Before SQL Bundling
hostmstr: 2036506624: HOA Before hoxpars
Entered hgopars, cursor id 1 at 2012/05/31-13:11:27
type:0
SQL text from hgopars, id=1, len=23 ...
00: 53454C45 4354202A 2046524F 4D202243 [SELECT * FROM "C]
10: 454E5452 4F5322 [ENTROS"]
Exiting hgopars, rc=0 at 2012/05/31-13:11:28
hostmstr: 2036506624: HOA After hoxpars
hostmstr: 2036506624: RPC After SQL Bundling
hostmstr: 2036506624: RPC Before SQL Bundling
hostmstr: 2036506624: HOA Before hoxopen
Entered hgoopen, cursor id 1 at 2012/05/31-13:11:28
hgoopen, line 87: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2012/05/31-13:11:28
hostmstr: 2036506624: HOA After hoxopen
hostmstr: 2036506624: HOA Before hoxdscr
Entered hgodscr, cursor id 1 at 2012/05/31-13:11:28
Allocate hoada @ 023E983C
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]*Descriptor type out of range* {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:1(codcen): dtype:1 (CHAR), prc/scl:8/0, nullbl:0, octet:8, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:2(litcen): dtype:1 (CHAR), prc/scl:45/0, nullbl:0, octet:45, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:3(codpos): dtype:1 (CHAR), prc/scl:5/0, nullbl:0, octet:5, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:4(codprov): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:5(codmun): dtype:1 (CHAR), prc/scl:3/0, nullbl:0, octet:3, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:6(codecol): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:7(codesin): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:8(cb): dtype:1 (CHAR), prc/scl:4/0, nullbl:0, octet:4, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:9(cs): dtype:1 (CHAR), prc/scl:4/0, nullbl:0, octet:4, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:10(digitocon): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:11(cuenta): dtype:1 (CHAR), prc/scl:10/0, nullbl:0, octet:10, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopcda at 2012/05/31-13:11:28
Column:12(solar): dtype:2 (NUMERIC), prc/scl:5/0, nullbl:0, octet:10, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopcda at 2012/05/31-13:11:28
Column:13(construido): dtype:2 (NUMERIC), prc/scl:5/0, nullbl:0, octet:10, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:14(domicen): dtype:1 (CHAR), prc/scl:40/0, nullbl:0, octet:40, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:15(telef): dtype:1 (CHAR), prc/scl:11/0, nullbl:0, octet:11, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:16(fax): dtype:1 (CHAR), prc/scl:11/0, nullbl:0, octet:11, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:17(cif): dtype:1 (CHAR), prc/scl:11/0, nullbl:0, octet:11, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
Entered hgopcda at 2012/05/31-13:11:28
Column:18(litloc): dtype:1 (CHAR), prc/scl:30/0, nullbl:0, octet:30, sign:1, radix:0
Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
hgodscr, line 910: Printing hoada @ 023E983C
MAX:18, ACTUAL:18, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
1 CHAR N 8 8 0/ 0 0 0 200 codcen
1 CHAR N 45 45 0/ 0 0 0 200 litcen
1 CHAR N 5 5 0/ 0 0 0 200 codpos
1 CHAR N 2 2 0/ 0 0 0 200 codprov
1 CHAR N 3 3 0/ 0 0 0 200 codmun
1 CHAR N 2 2 0/ 0 0 0 200 codecol
1 CHAR N 2 2 0/ 0 0 0 200 codesin
1 CHAR N 4 4 0/ 0 0 0 200 cb
1 CHAR N 4 4 0/ 0 0 0 200 cs
1 CHAR N 2 2 0/ 0 0 0 200 digitocon
1 CHAR N 10 10 0/ 0 0 0 200 cuenta
3 DECIMAL N 7 7 5/ 0 0 0 0 solar
3 DECIMAL N 7 7 5/ 0 0 0 0 construido
1 CHAR N 40 40 0/ 0 0 0 200 domicen
1 CHAR N 11 11 0/ 0 0 0 200 telef
1 CHAR N 11 11 0/ 0 0 0 200 fax
1 CHAR N 11 11 0/ 0 0 0 200 cif
1 CHAR N 30 30 0/ 0 0 0 200 litloc
Exiting hgodscr, rc=0 at 2012/05/31-13:11:28 with error ptr FILE:hgodscr.c LINE:615 ID:Transfer Octet Length
hostmstr: 2036506624: HOA After hoxdscr
hostmstr: 2036506624: RPC After SQL Bundling
hostmstr: 2036506624: RPC Before SQL Bundling
hostmstr: 2036506624: HOA Before hoxclse
Entered hgoclse, cursor id 1 at 2012/05/31-13:11:28
Exiting hgoclse, rc=0 at 2012/05/31-13:11:28
hostmstr: 2036506624: HOA After hoxclse
hostmstr: 2036506624: HOA Before hoadafr
Entered hgodafr, cursor id 1 at 2012/05/31-13:11:28
Free hoada @ 023E983C
Exiting hgodafr, rc=0 at 2012/05/31-13:11:28
hostmstr: 2036506624: HOA After hoadafr
hostmstr: 2036506624: HOA Before hoxpars
Entered hgopars, cursor id 1 at 2012/05/31-13:11:28
type:0
SQL text from hgopars, id=1, len=235 ...
00: 53454C45 43542041 312E2263 6F646365 [SELECT A1."codce]
10: 6E222C41 312E226C 69746365 6E222C41 [n",A1."litcen",A]
20: 312E2263 6F64706F 73222C41 312E2263 [1."codpos",A1."c]
30: 6F647072 6F76222C 41312E22 636F646D [odprov",A1."codm]
40: 756E222C 41312E22 636F6465 636F6C22 [un",A1."codecol"]
50: 2C41312E 22636F64 6573696E 222C4131 [,A1."codesin",A1]
60: 2E226362 222C4131 2E226373 222C4131 [."cb",A1."cs",A1]
70: 2E226469 6769746F 636F6E22 2C41312E [."digitocon",A1.]
80: 22637565 6E746122 2C41312E 22736F6C ["cuenta",A1."sol]
90: 6172222C 41312E22 636F6E73 74727569 [ar",A1."construi]
A0: 646F222C 41312E22 646F6D69 63656E22 [do",A1."domicen"]
B0: 2C41312E 2274656C 6566222C 41312E22 [,A1."telef",A1."]
C0: 66617822 2C41312E 22636966 222C4131 [fax",A1."cif",A1]
D0: 2E226C69 746C6F63 22204652 4F4D2022 [."litloc" FROM "]
E0: 43454E54 524F5322 204131 [CENTROS" A1]
Entered hgopoer at 2012/05/31-13:11:28
hgopoer, line 233: got native error 200 and sqlstate 42000; message follows...
[Microsoft][ODBC Visual FoxPro Driver]Syntax error. {42000,NativeErr = 200}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgopars, line 457: calling SQLPrepare got sqlstate 42000
Exiting hgopars, rc=28500 at 2012/05/31-13:11:28 with error ptr FILE:hgopars.c LINE:487 ID:Prepare stmt
hostmstr: 2036506624: HOA After hoxpars
hostmstr: 2036506624: RPC After SQL BundlingThe first issue I see is that Oracle 10.2.0.1 was never certified with DG4ODBC 11. Only 10.2.0.4 or 10.2.0.5 can be used as the Oracle database HS kernel requires a gateway compatibility patch and this patch is included in 10.2.0.4 or 10.2.0.5 Oracle database patch set.
Then another error in the trace is that for each column description you have an error:
hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
[Microsoft][ODBC Visual FoxPro Driver]*Descriptor type out of range* {HY091}
Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
It seems it is not critical as DG4ODBC continues, but a more detailed analysis would require an ODBC trace.
When looking at the table description it seems the column names are all in lower letters, for example: solar. So commonly Dg4ODBC needs to quote the names
00: 53454C45 43542041 312E2263 6F646365 [SELECT A1."codce]
10: 6E222C41 312E226C 69746365 6E222C41 [n",A1."litcen",A]
20: 312E2263 6F64706F 73222C41 312E2263 [1."codpos",A1."c]
30: 6F647072 6F76222C 41312E22 636F646D [odprov",A1."codm]
40: 756E222C 41312E22 636F6465 636F6C22 [un",A1."codecol"]
50: 2C41312E 22636F64 6573696E 222C4131 [,A1."codesin",A1]
60: 2E226362 222C4131 2E226373 222C4131 [."cb",A1."cs",A1]
70: 2E226469 6769746F 636F6E22 2C41312E [."digitocon",A1.]
80: 22637565 6E746122 2C41312E 22736F6C ["cuenta",A1."sol]
90: 6172222C 41312E22 636F6E73 74727569 [ar",A1."construi]
A0: 646F222C 41312E22 646F6D69 63656E22 [do",A1."domicen"]
B0: 2C41312E 2274656C 6566222C 41312E22 [,A1."telef",A1."]
C0: 66617822 2C41312E 22636966 222C4131 [fax",A1."cif",A1]
D0: 2E226C69 746C6F63 22204652 4F4D2022 [."litloc" FROM "]
E0: 43454E54 524F5322 204131 [CENTROS" A1]
and according to the trace the FoxPro ODBC driver doesn't like these quotes and reports a syntax error.
So this explains at least why select codcen from centros@fox1 will fail. In general the Oracle database is case insensitive and translates all object names to upper case and the select it will pass to the foreign database would be similar to:
select CODCEN from CENTROS => which will fail as FoxPro is case sensitive. So the error message ORA-00904 (missing column name) is correct and the statement you need to use is:
select "codcen" from centros@fox1;
But this might lead again to the Syntax error you got earlier => You need to check which sign (single quote, back tick, double quote) Foxpro uses to quote object names and then set the gateway parameter HS_FDS_QUOTE_IDENTIFIER accordingly.
To check which character can be used to quote column/table names you might use the Microsoft ODBc test utility which was distributed in the old MDAC 2.8:
http://www.microsoft.com/downloads/details.aspx?familyid=5067faf8-0db4-429a-b502-de4329c8c850&displaylang=en
Edited by: kgronau on Jun 1, 2012 7:27 AM
If you know where I can download the MS FoxPro ODBC driver, please let me know and I'll check. -
Value has to be entered for an optional parameter for WS
Hi,
I have created a webservice from a PL/SQL package using the below tutorial.
http://st-curriculum.oracle.com/obe/jdev/obe1013jdev/10131/wsfromplsqlpackage/devwsfrom%20plsql.htm
I wrote my package to get the user status from fnd_user table. The package/procedure cannot get simpler than this. There are 2 input parameters (optional) and 1 output parameter. I am able to call this pkg-proc from SQL Plus and everything works fine. I can pass either of the 2 input parameters and the procedure returns the correct information depending upon what is passed. However when I exposed this as a web service, and if I do not pass the user id parameter, I get "Caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: """ error. I tried nillable="true" and minOccurs="0" for user id but still it seems the web service is forcing me to enter the value for user id parameter. The other way works i.e. if user name is left blank.
If I change the data type for the 1st parameter (p_user_id) to varchar2, then the WS returns proper info. Seems like nillable="true" works for string (varchar2) datatype but not for integer or number.
Any help will be truly appreciated. Thanks.
CREATE OR REPLACE package xxcc_ws is
procedure Get_User_Status (
p_user_id IN INTEGER DEFAULT 0
,p_user_name IN VARCHAR2 DEFAULT NULL
,p_ret_msg OUT VARCHAR2
END xxcc_ws;
CREATE OR REPLACE package body xxcc_ws is
procedure Get_User_Status (
p_user_id IN INTEGER DEFAULT 0
,p_user_name IN VARCHAR2 DEFAULT NULL
,p_ret_msg OUT VARCHAR2
) is
lr_fu_rec apps.fnd_user%ROWTYPE;
begin
select *
into lr_fu_rec
from apps.fnd_user
where user_id = nvl(p_user_id, user_id)
and user_name = nvl(p_user_name, user_name);
-- warn if the person is end dated
if lr_fu_rec.end_date is not null then
p_ret_msg := 'WARNING:Person is end dated as of '||to_char(lr_fu_rec.end_date,'mm/dd/yyyy');
else
p_ret_msg := 'SUCCESS:'||lr_fu_rec.employee_id||':'||lr_fu_rec.email_address;
end if;
return;
exception
when others then
p_ret_msg := 'ERROR:'||sqlerrm;
return;
end Get_User_Status;
END xxcc_ws;
/Edited by: user13163442 on Nov 8, 2010 8:29 AMHi
I have tried pl/sql package via SOA gateway and it worked. -
Associative Array with more than one field - retrieving as output parameter
Hello,
I'm developing an C# Application that is showing a datagrid with results from a PL/SQL procedure inside a Package.
The .net project is in .net 4 and the DB is an oracle 10g.
I have read the odp.net sample about the associative array. I could successfully pass as an input parameter a string[] and dealing with it inside my PL/SQL procedure.
Now it become more complex to me because I would like to return an associative array defined like this :
TYPE r_FinalExtract IS RECORD
RecordmyTable myTable%ROWTYPE,
Tel1 varchar2(25),
Tel1Libelle varchar2(50),
Tel2 varchar2(25),
Tel2Libelle varchar2(50),
Tel3 varchar2(25),
Tel3Libelle varchar2(50),
Tel4 varchar2(25),
Tel4Libelle varchar2(50),
Tel5 varchar2(25),
Tel5Libelle varchar2(50),
Email1 varchar2(50),
Email1Libelle varchar2(50),
Email2 varchar2(50),
Email2Libelle varchar2(50)
TYPE t_FinalExtract IS TABLE OF r_FinalExtract INDEX BY BINARY_INTEGER;
You can guess my PL/SQL stored procedure is filling this collection.
The spec of my procedure :
PROCEDURE P_SELECTDATA( ptab_ListRef IN t_AssocArrayVarchar2, ptab_Result OUT t_FinalExtract );
Unfortunately, in my .net project, I don't know how to deal with that.
I tryed to add p_Result as an output parameter but you have to define the OracleCollectionType for that parameter and the array type is not the good one because my t_FinalExtract is not a simple array...
I searched over the internet and the only one thread I could find is someone who was doing like me... and finally reply to his own thread 3 months later and said that he had to create CSV lines and return a table of varchar2...
This is what I will do because I'm loosing time for finding the way to do it with my associative array, but if someone has the solution I would be glad to read it.
Thanks in advance.For PL/SQL records, I would recommend using User-Defined Types (UDTs), rather than associative arrays.
You can read more on how to use ODP.NET UDTs here:
http://docs.oracle.com/cd/E20434_01/doc/win.112/e23174/featUDTs.htm#CJAGCAID
Strictly speaking, ODP.NET doesn't support PL/SQL Records per se. Instead, ODP.NET supports building any generic UDT in the Oracle DB, which covers the effective functionality of a Record.
If you want to walk through the process of taking a sample DB UDT, generating a .NET custom class, then passing an instance between DB and application, here's a tutorial that shows you how to do that:
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/userdefinedtypes/userDefinedTypes.htm -
Oracle Reports 9I generate output in excel
Report Builder 9.0.4.0.33
I tried generating output to Excel using 10GR2 Report builder using SPREADSHEET for destype on the web and it works.
The requirement is for this one customer who is on 9I and they are asking for excel output functiuonality on thier existing reports.
Does oracle has a patch or any other way to generate the exisitng reports on 91 where we can give them a selection like SPREADSHEET in the parameter screen and it would generate the report in excel.
Thanks
I tried by appending below to the url in the before report trigger.
&mimetype=application/vnd.ms-excel
which works but, we give other selections to the user too where they can change the desformat to PDF or HTMLCSS...and they all try to open the report output in excel.
Edited by: Forms_Reports_Beginner on Oct 6, 2009 3:17 PMThank you Lalitk and Dennis,
My team mate wrote a javascript function on before report trigger that checks the paramter selection for desformat and append the mimetype accordingly.Hence, able to achieve the functionality.
Thanks. -
Calling Stored Procedure with Boolean Output Parameter
Hi all,
I'm running into an issue (or is it a BUG) when calling a Database Stored Procedure that has an output parameter of the boolean type.
procedure proc(p_text in varchar2, p_result out boolean)
is
.....I use the following 'standard' code (developer guide 36-19 36-20) to invoke this procedure from my application module.
try {
// 1. Define the PL/SQL block for the statement to invoke
String stmt = "begin proc(?,?); end;";
// 2. Create the CallableStatement for the PL/SQL block
st = getDBTransaction().createCallableStatement(stmt, 0);
// 3. Register the positions and types of the OUT parameters
st.registerOutParameter(2, Types.BOOLEAN);
// 4. Set the bind values of the IN parameters
st.setObject(1, "Some text");
// 5. Execute the statement
st.executeUpdate();
..............................As soon as 'st.registerOutParameter(2, Types.BOOLEAN);' is invoked I run into a SQLexception. "Invalid ColumnType: 16". Obviously 16 refers to Types.BOOLEAN.
[edit by Luc]
SOLUTION / WORKAROUND
To answer my own question.
It looks like BOOLEAN output parameters are not supported. I just Read "Appendix D Troubleshooting" of the Oracle® Database JDBC Developer's Guide and Reference 10g Release 2 (10.2).
I found that JDBC drivers do not support the passing of BOOLEAN parameters to PL/SQL stored procedures. If a PL/SQL procedure contains BOOLEAN values, you can work around the restriction by wrapping the PL/SQL procedure with a second PL/SQL procedure that accepts the argument as an INT and passes it to the first stored procedure. When the second procedure is called, the server performs the conversion from INT to BOOLEAN.
I'm not very happy with this but I guess I've no choice.
Regards Luc
Edited by: lucbors on Nov 30, 2010 10:37 AMfyi
Related to the solution/workaround posted by Luc.
see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
regards
Jan Vervecken -
REST Web Service Output Parameter not working in POST Handler
I've created a RESTful Web Service in Oracle Apex, using a POST method as "handler". I've setup 11 input parameters which all work fine, it is my one output parameter that does not return successfully.
Here is detail on the Output Paramter
Name: returns
Bind Variable Name: :returns
Access Method: OUT
Source Type: Response
Parameter Type: String
The actual source is a call to a pl/sql package that returns a value that I set :returns equal to (eg :returns := v_result). I've tried this with Source Type Header and still the same result, 'no output'.
I see APEX is calling wwv_flow_api.create_restful_param to generate the parameters (for importing), is there any documentation on this procedure?
How can I get this output parameter to return something in the response?
The request accepts a Json payload.
Any help greatly appreciated
Thanks,
JamesSolved my own problem :returns does not work needs to be returns
Does Not Work
Name: returns
Bind Variable Name: :returns
Access Method: OUT
Source Type: Response
Parameter Type: String
Does Work
Name: returns
Bind Variable Name: returns
Access Method: OUT
Source Type: Response
Parameter Type: String
Maybe you are looking for
-
Opening Freehand files in Illustrator
Can I open Freehand MX files in Illustrator CS3? Thanks, Joze
-
User defined fields for PM order operation
I want to restrict the users from changing the object (Key word for User defiened fields) in the Enhancement tab of PM order Operations. I have created one object (TCode OPEC) by configuring the required fields. Created one authorisation object by co
-
HT4436 Help Apple ID from ICloud to IPhone
Hi, I created a new Apple ID, however the ID to access my email (icloud) from my iPhone, still shows the old ID. How do I change this? I am afraid that if I hit 'delete account' my entire email will dissapear. Your help will be apreciated. Thanks!
-
Does Mozilla share data with government agency(ies), and if so what data?
I'm looking to switch to a provider who values privacy, and has the integrity to say 'no' to agencies who request personal data illegally. Does Mozilla protect the privacy of their users? This is not a matter of degree; it is a yes or no answer.
-
AP541N-E-K9 keeps dropping all WLAN connections
I hope someone could shed some light on an issue we have with our AP541N-E-K9 on the latest firmware. Our issue sounds similar to this thread: https://supportforums.cisco.com/thread/2028334 Our AP541N-E-K9 keeps dropping all WLAN connections and will