Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Oracle problems

Oracle problems

From: <rahul.gauba_at_riverrun.com>
Date: Sat, 13 Nov 1999 05:31:05 GMT
Message-ID: <80it2p$va1$1@nnrp1.deja.com>


Hello !!
I have an odbc application.I am connecting to an oracle8 database.

  1. The SQLDataType that I am passing in SQLGetTypeInfo is a variable whose value I get using SQLColumns call. In case of BLOB datatype that variable has value -402.Now Since SQLGetTypeInfo returns SQL_ERROR,
    (Datatype out of range ,SQL state S1004).
    I am unable to find the the type name corresponding to that SQLDataType.
  2. If I give rowsize in SQLSetStmtOption as more than 1,even though it returns SQL_SUCCESS,the SQLFetch does not fetch any data for any datatype.
  3. Is it necessary to use TO_DATE while using Date Datatype in SQL Statements.

(E.g..

Right now I have a statement :

          Insert into Date_tab Values(TO_DATE('1999-10-10 10:10:10', 'yyyy-mm-dd hh24:mi:ss')
if I don't use the TO_DATE fn, and give the statement as :

           Insert into Date_tab Values('1999-10-10 10:10:10') I get an error : [Oracle][ODBC][Ora]ORA-01861: literal does not match format string.)
Is there any way round where I don't need to use TO_DATE. I want to insert date in 'yyyy-mm-dd hh24:mi:ss' format.

4. I get an error 22275(invalid lob locator specified) while inserting into a table having lob datatypes.
What should I do to provide support for LOB structures in my application.

5. I have defined a Number Datatype in Oracle. When I try to fetch the Length and datatype of the Column using SQLColumn API , it returns Datatype as SQL_DECIMAL and length as 22.This is irrespective of the precision and scale specified.How can I find out the exact attributes(precision and datatype) of the NUMBER column.

 I'm using :
ODBC SDK version 3.5
Oracle ODBC Driver 8.0
ODBC DRIVER 3.0
I have included the section of code where I am facing the problem.

Also It would be very helpful if you could recommend a book dealing with ODBC and Oracle8.
Expecting an early reply,
Thanks,
Sheenu

// code

	rc = SQLSetStmtOption(hstmt, SQL_ROWSET_SIZE, g_uiRowsize);
	if(rc == SQL_ERROR || rc == SQL_INVALID_HANDLE)
	{
		SQLFreeStmt(hstmt, SQL_CLOSE);
		iRetVal = FAIL;
		goto END;
	}

	rc = SQLGetTypeInfo(hstmt,swSQLDataType);
	if((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
	{
		switch (swSQLDataType)
		{
		case SQL_ORCL_BLOB  :
					_tcscpy (pszTypeName,"BLOB");
					iRetVal = SUCCESS;
					goto FREEHSTMT;
					break ;
		case SQL_ORCL_BFILE  :
					_tcscpy (pszTypeName,"BFILE");
					iRetVal = SUCCESS;
					goto FREEHSTMT;
					break ;
		case SQL_ORCL_CLOB  :
					_tcscpy (pszTypeName,"CLOB");
					iRetVal = SUCCESS;
					goto FREEHSTMT;
					break ;

	}
	rc = SQLError(henv,hdbc,hstmt,(ODBC_CHAR FAR *)szSqlState,
					  (SDWORD FAR *)
&nativeError,(ODBC_CHAR FAR *)szErrorMsg,
					  cbErrorMsgMax,(SWORD FAR *)
&cbErrorMsg);
		 AfxMessageBox ((LPCTSTR) szErrorMsg);
		iRetVal = FAIL;
		goto FREEHSTMT;
	}

	rc = SQLBindCol

(hstmt,1,SQL_C_TCHAR,pszTempTypeName,(MAX_STRN_LENGTH + 1)*sizeof
(TCHAR),&sdwTempTypeName);
	rc = SQLFetch(hstmt);
	if((rc EQ SQL_SUCCESS) || (rc EQ SQL_SUCCESS_WITH_INFO))
	{
		_tcscpy (pszTypeName,pszTempTypeName);
		iRetVal = SUCCESS;
		goto FREEHSTMT;
	}
	else
	{
		if(rc EQ SQL_NO_DATA_FOUND)
		{
			iRetVal = SQL_NO_DATA_FOUND;
 			goto FREEHSTMT;
		}
       }


Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Nov 12 1999 - 23:31:05 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US