473,779 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle Dates through Data Provider - ORA-01858

Hi,

I'm having a nightmare when trying to insert records into an Oracle
database that contain dates. I've believe I should be using the
to_date() function but I continually get the error:

"ORA-01858: a non-numeric character was found where a numeric was
expected"

I'm reading from a text file and the datetime values are as follows:

12-DEC-2003 12:01:22
12-DEC-2003 12:01:23
12-DEC-2003 12:01:24
12-DEC-2003 12:01:25

If I carry out straight forward SQL upon the database I can insert
records without any problems. E.g.:

INSERT INTO MyTable (Name, OccurrenceTime)
VALUES ('Test', to_date('31-Dec-2004 10:47:50', 'DD-MON-YYYY
HH:MI:SS') );

However, my problem is achieving the same results from my C#
application that uses the DataTable structure and OracleDataAdapt er
object.

The DataTable's Rows.List[0] contains:

ItemArray[0] = "Test"
ItemArray[1] = "to_date('3 1-DEC-2004 10:47:50', 'DD-MON-YYYY
HH:MI:SS')"

However, when I call the Update() method of OracleDataAdapt er and pass
the DataTable as the parameter I get the ORA-01858 error.

Can I pass: 'to_date(....)' via the DataTable? It appears from what
I've found on the newsgroups that you cannot pass a literal date
straight into Oracle.

Please, if anyone can help, I would very much appreciate it.

Regards,

Paul.
Jul 19 '05 #1
1 10393
pa*********@hot mail.com (Paul Long) wrote in message news:<4c******* *************** ****@posting.go ogle.com>...
Hi,

I'm having a nightmare when trying to insert records into an Oracle
database that contain dates. I've believe I should be using the
to_date() function but I continually get the error:

"ORA-01858: a non-numeric character was found where a numeric was
expected"

I'm reading from a text file and the datetime values are as follows:

12-DEC-2003 12:01:22
12-DEC-2003 12:01:23
12-DEC-2003 12:01:24
12-DEC-2003 12:01:25

If I carry out straight forward SQL upon the database I can insert
records without any problems. E.g.:

INSERT INTO MyTable (Name, OccurrenceTime)
VALUES ('Test', to_date('31-Dec-2004 10:47:50', 'DD-MON-YYYY
HH:MI:SS') );

However, my problem is achieving the same results from my C#
application that uses the DataTable structure and OracleDataAdapt er
object.

The DataTable's Rows.List[0] contains:

ItemArray[0] = "Test"
ItemArray[1] = "to_date('3 1-DEC-2004 10:47:50', 'DD-MON-YYYY
HH:MI:SS')"

However, when I call the Update() method of OracleDataAdapt er and pass
the DataTable as the parameter I get the ORA-01858 error.

Can I pass: 'to_date(....)' via the DataTable? It appears from what
I've found on the newsgroups that you cannot pass a literal date
straight into Oracle.

Please, if anyone can help, I would very much appreciate it.

Regards,

Paul.


Paul, I am not familiar with the tool you are using but does your
program error immediately or is it processing for a little while
before it dies? If it is processing then you might just have some
invalid data in some of your input.

Second check the date data to see if 24 hour clock is in use or if you
need to account for an AM/PM indicator. For the 24 hour clock you
would need HH24 in your format mask.

The idea of what might be messing you up is to check to see if the low
digit days are entered as '01' or just '1'. If may be that the tool
has a problem related to number of digits for the first through ninth.

Good Luck,
-- Mark D Powell --
Jul 19 '05 #2

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

Similar topics

2
12645
by: Barry Young | last post by:
I am using the following code to insert a row in an Oracle Database. strConnection = "Provider=OraOLEDB.Oracle;Data Source=MYDATABASE;User Id=SYSTEM;Password=******" Dim strMessage As String Dim objConnection As New OleDb.OleDbConnection(strConnection) Dim objCommand As OleDb.OleDbCommand
3
24287
by: David Gray | last post by:
Hello all, Having problems connecting to an Oracle 9i database from within SQL/Server 2000 using the Security/Linked Servers feature. Server1 (SQL/Server) ----------- Windows Server 2003, Standard edition MS SQL/Server 2000 Oracle 9i Client kit (OLEDB & ODBC) & Enterprise management tools
4
5213
by: Ellen K. | last post by:
Hi all, Being that so far I didn't get an answer to my below problem on the Oracle newsgroup, I figured it couldn't hurt to try here. While at my current job I've been working with mostly SQL Server, now I need to connect to our Oracle Financials running on HP-UX. The Oracle DBA set me up as a user and installed the Oracle client on my box and I have the tnsnames file, but I still can't establish a connection to the database from my...
2
10480
by: Chris | last post by:
In SQL Server 2000 I have set up an Oracle linked server. When I run the following query it runs fine:- SELECT * FROM OPENQUERY(LINKEDSERVERNAME,'SELECT * FROM ORACLETABLENAME') However the following query does not work:-
13
7481
by: Chris Botha | last post by:
The machine is running XP Pro with all the latest service packs, etc. I must access an Oracle database so I installed the Oracle client stuff. I can query Oracle from a Windows app, no problem. Using the exact same code (copy and paste) into a Web app I get the following error "Error while trying to retrieve text for error ORA-01019". Security I thought, so I use Impersonation on the Web site, then the aspnet_wp.exe crashes with "The...
8
14376
by: danbredy | last post by:
Hi, I'm attempting to connect to an Oracle database using SQL Server 2005 Express (OS is Windows XP Professional) and having absolutely no luck. Here is the information SQL Plus gives me about the database when I log in - Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options
7
4362
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work. I tried that quickly, but the file is 400 MB, and the the installation asks for all kinds of things in order to install. Now I'm very confused. a) Do you still need ODP.NET with framework 2.0? b) Do you need to download and install other...
9
2419
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work. I tried that quickly, but the file is 400 MB, and the the installation asks for all kinds of things in order to install. Now I'm very confused. a) Do you still need ODP.NET with framework 2.0? b) Do you need to download and install other...
1
4924
by: jonl | last post by:
Hi, I was devloping on a remote corporate web server(MS XP) building webapps using simple asp. I then moved the code to my desktop(MS 2000) which also has a webserver and encountered connectivity errors. This is connecting to Oracle (9.2 on a solaris sparc 5.8) using MSDAORA. As far as I can tell both the remote webserver and the desktop use the same tnsnames file (on the lan). The databases being accessed are remote to both webservers. ...
5
8411
by: kimtherkelsen | last post by:
Hi, I use the System.Data.OleDb.OleDbConnection class to establish a connection to a Oracle 10G database. The dsn connection string I use look like this: dsn=provider="MSDAORA.1";User ID=test;Data Source="172.30.0.25/ JBOS";Password=test; This works fine in Windows XP and Windows server 2003 but I have a customer that try to connect to the database from a Windows 2000
0
9471
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9925
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.