Feedback
Did this article resolve your question/issue?

   

Article

Oracle Wire Protocol driver returns incorrect results while comparing timestamps

Information

 
TitleOracle Wire Protocol driver returns incorrect results while comparing timestamps
URL Nameoracle-wire-protocol-driver-returns-incorrect-results-while-comparing-timestamps
Article Number000183193
EnvironmentProduct: Connect for ODBC Oracle Wire Protocol driver
Version: All supported versions
OS: All supported platforms
Database: Oracle
Application: All supported apllications
Question/Problem Description
Oracle Wire Protocol driver returns incorrect results while comparing timestamps
Steps to Reproduce
Clarifying Information
DDL:

1. CREATE TABLE BIGAFED_ALLTYPES_SDS1 (TMSTP TIMESTAMP)
2. INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (timestamp '2002-03-22 15:25:49.000000'),
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (timestamp '2002-03-22 15:25:50.000000'),
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (timestamp '2002-03-22 15:25:51.000000'), 
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (timestamp '2002-03-22 15:25:52.000000'), 
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (null), 
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (null), 
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (timestamp '1984-01-30 07:00:00.000000'), 
INSERT INTO BIGAFED_ALLTYPES_SDS1 VALUES (null)


Steps to Reproduce:

Execute :
 SELECT A0."TMSTP" C0 FROM BIGAFED_ALLTYPES_SDS1 A0 WHERE (TO_DATE(TO_CHAR(A0."TMSTP",'HH24.MI.SS'),'HH24.MI.SS') < {t'07:07:22')

Observed Results:

SQLExecDirect:
In: hstmt = 0x00000000003AA9C0, 
szSqlStr = "SELECT A0."TMSTP" C0 FROM BIGAFED_ALLTYPES_SDS1 A0 WHE...", cbSqlStr = -3
Return: SQL_SUCCESS=0

Get Data All:
"C0"
2002-03-22 15:25:49.000000
2002-03-22 15:25:50.000000
2002-03-22 15:25:51.000000
2002-03-22 15:25:52.000000
1984-01-30 07:00:00.000000
5 rows fetched from 1 column.


Expected Results:
Get Data All:
"C0"
1984-01-30 07:00:00.000000
1 row fetched from 1 column.


 
Error Message
Defect Number
Enhancement Number
Cause
This is not a driver issue. The cause is an incorrect SELECT statement
Resolution
Use the below SELECT statement:
SELECT TMSTP C0 FROM BIGAFED_ALLTYPES_SDS1 WHERE (TO_DATE(TO_CHAR(TMSTP,'HH24.MI.SS'),'HH24.MI.SS') < TO_DATE('07:07:22','HH24.MI.SS'))
Workaround
Notes
Last Modified Date9/12/2022 11:29 PM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.