473,499 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ORA-1866 The datetime class is invalid error

Hello all
Thank you all in advance. I am completely at a loss here with this error. I am developing a simple interface that will allow a user to enter,execute and view results from a SQL statement to our oracle database. I have found that I can not query more than a single day at a time when using a date > 12/31/2002 as my where clause
For example

select * from tclaim where (process_date >= to_date('02/01/04', 'mm/dd/yy')) and (process_date < to_date('02/05/04','mm/dd/yy')

select * from tclaim where process_date >= '01-FEB-2004' and process_date < '05-FEB-2004

Neither one of the above statements will execute unless I make the year less than 2003 in my dates or only ask to return one day. I have poured over several sites and articles without so much as a clue why this is happening. Any help would be greatly appreciated as I am desparately trying to showcase VB.NET to my employers and not being able to query data using a date field in this calendar year is sure going to make this a hard sell

Thank you!!
Jul 21 '05 #1
4 4366
Hi Malcolm,

You are talking about Oracle problem that has nothing to do with VB.NET.
As a better approach you might use parametrised query.
Something like:
select * from tclaim where (process_date >= :fromDate) and (process_date <
:toDate)
cmd.Parameters.Add(":fromDate", OracleType.DateTime).Value = fromDate '
insert your date here
cmd.Parameters.Add(":toDate", OracleType.DateTime).Value = toDate ' insert
your date here

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Malcolm Diaz" <md***@planvista.com> wrote in message
news:AA**********************************@microsof t.com...
Hello all,
Thank you all in advance. I am completely at a loss here with this error. I am developing a simple interface that will allow a user to
enter,execute and view results from a SQL statement to our oracle database.
I have found that I can not query more than a single day at a time when
using a date > 12/31/2002 as my where clause. For example;

select * from tclaim where (process_date >= to_date('02/01/04', 'mm/dd/yy')) and (process_date < to_date('02/05/04','mm/dd/yy'))
select * from tclaim where process_date >= '01-FEB-2004' and process_date < '05-FEB-2004'
Neither one of the above statements will execute unless I make the year less than 2003 in my dates or only ask to return one day. I have poured over
several sites and articles without so much as a clue why this is happening.
Any help would be greatly appreciated as I am desparately trying to showcase
VB.NET to my employers and not being able to query data using a date field
in this calendar year is sure going to make this a hard sell!
Thank you!!

Jul 21 '05 #2
Hello,

Thanks for your post. As I understand, the problem you are facing is that a
SQL statement does not work properly when using a date > 12/31/2002. Please
correct me if there is any misunderstanding.

1. Make sure that there are several rows with date > 12/31/2002 in your
table.

2. To narrow down the problem, I suggest that you can execute the SQL
statement in Oracle SQL Plus window and see if it works.

2. In addition, you can also try other date format in SQL statement. For
example:

select * from tclaim where process_date >= '2004-02-01' and process_date <
'2005-02-01'

I am standing by for your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Actually, yes it's an error message returned by Oracle but both example SQL statements I provided earlier will execute flawlessly in any enviornment BUT my vb.net code. I've tried both statements in SQL*PLUS, SQL Worksheet, and Tools For Oracle(aka Tora) with no problems at all. Only when using VB.NET does it blow up on me. All this leads me to believe that it is VB.NET that is experiencing a problem. The parametrised query is a good idea but makes no difference....as long as I insist on asking for more than a single days worth of data in 2003 or 2004 it will not execute. Can anyone at all point me in a different direction
Again I thank you all in advance for what advice you may send me and to those who have replied I am in your debt! Thank you

----- Miha Markic [MVP C#] wrote: ----

Hi Malcolm

You are talking about Oracle problem that has nothing to do with VB.NET
As a better approach you might use parametrised query
Something like
select * from tclaim where (process_date >= :fromDate) and (process_date
:toDate
cmd.Parameters.Add(":fromDate", OracleType.DateTime).Value = fromDate
insert your date her
cmd.Parameters.Add(":toDate", OracleType.DateTime).Value = toDate ' inser
your date her

--
Miha Markic [MVP C#] - RightHand .NET consulting & software developmen
miha at rthand co
www.rthand.co

"Malcolm Diaz" <md***@planvista.com> wrote in messag
news:AA**********************************@microsof t.com..
Hello all
Thank you all in advance. I am completely at a loss here with thi error. I am developing a simple interface that will allow a user t
enter,execute and view results from a SQL statement to our oracle database
I have found that I can not query more than a single day at a time whe
using a date > 12/31/2002 as my where clause For example
select * from tclaim where (process_date >= to_date('02/01/04' 'mm/dd/yy')) and (process_date < to_date('02/05/04','mm/dd/yy') select * from tclaim where process_date >= '01-FEB-2004' and process_dat < '05-FEB-2004 Neither one of the above statements will execute unless I make the yea less than 2003 in my dates or only ask to return one day. I have poured ove
several sites and articles without so much as a clue why this is happening
Any help would be greatly appreciated as I am desparately trying to showcas
VB.NET to my employers and not being able to query data using a date fiel
in this calendar year is sure going to make this a hard sell Thank you!


Jul 21 '05 #4
I've tried both statements in SQL*PLUS, SQL Worksheet, and Tools For Oracle(aka Tora) with no problems at all. Only when using VB.NET does it blow up on me. All this leads me to believe that it is VB.NET that is experiencing a problem. I also played with using several different date formats in my efforts but to no avail. Like before I can get the query to execute perfectly anywhere but my vb.net enviornment. This is extremely frustrating as this simple problem is causing me to lose my fight for VB.NET in the work place. I can't justify reccommending this product as long as a simple SQL statment is going to cause so much problems. At this point I would much rather have someone more versed in the language find a silly or even an out right stupid mistake in my code as the problem than to have to tell my employer that VB.net could handle a simple query. I refuse to believe it can't be done

Again I thank you all for any help at all.
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3925
by: Ping | last post by:
Where can i find the initialization file to change some parameters? This file used to be init<sid>.ora in previous versions of oracle. Oracle 9.2 on xp is in question. Thanks in advance ...
1
5125
by: Adam Ruth | last post by:
I'm using OCI on Mac OS X and I've run into a strange problem with my TNSNAMES.ORA file. My TNSNAMES.ORA file has one entry INV4II and it works fine. However, it will only work if that is the...
6
4670
by: bdj | last post by:
Hello! I have at set of tnsnames.ora. I wich to make an union, e.g. a single file of it. How can I do that easy? Greetings Bjørn
1
14871
by: Paul Green | last post by:
What might cause the following behavior? We have a set of front-end programs accessing an Oracle database on the server. Things work fine on our older computers and mostly OK on our new computers...
5
17091
by: jstmehr4u3 | last post by:
I just installed ODP.net 10.2.02 on my local machine (Windows XP Pro) running IIS. I have created a sample webservice in VS2003, connecting to localhost. I am getting:...
2
43457
by: Dwie | last post by:
Dear All, I'm a new in Oracle DB. I'm using Windows 2000 as server and Windows XP as client. I installed Oracle Enterprise on server and Oracle 8.1 on clients. I have some client with 2 different...
7
8665
by: lrg | last post by:
I'm writing an application in ASP.NET using C# for code behind and i'm also using oracle 10g. I thought when i retrieve data from the DB first tnsnames.ora is referred. But my experience is that...
5
16992
by: Nitvar | last post by:
When i am trying to connect to oracle it is giving me these two errors ORA-12224: TNS:no listener ORA-01034: ORACLE not available I am new to oracle ,plz help I am using solaris 5.6 and...
1
2139
by: bacterium | last post by:
Hi, Is there any way to solve the question :'ORA-12154: TNS:could not resolve service name' ,I import database in Oracle , but I can not logon into the database , while login through the SQL PLUS,...
1
3150
by: michael ngong | last post by:
michael.john@gmx.at (Michael John) wrote in message news:<90cc4edd.0306230900.28075193@posting.google.com>... MIchael I you stated the OS and platform that could make it easier to address your...
0
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.