473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Convert Access dates to Oracle format

Hi,

I am writing to a text file the records in an access table that is to
be loaded into an Oracle system.

However, I have been told that the date fields in the records I have
exported to the text file that are not compatible with oracle. The
format looks like: 01/01/2006 and I need it to look like 01-JAN-2006.

I have tried using the format function and the variable still shows it
as 01/01/2006.

The text file is generated by clicking from a button on a form which
contains the string/date variables and a loop with the write lines. I
am not on my work PC at the minute so can't show what I've created, but
can post it later if needed.

Can anyone give me an idea of how to get this sorted.

Cheers.

Jan 26 '06 #1
5 6513
Gox
Try this function:

Function ToAmDate(dDatum As Variant) As Variant
If IsNull(dDatum) Then
ToAmDate = Null
Exit Function
End If
ToAmDate = LTrim(str(Day(dDatum))) & "-" &
LTrim(str(Month(dDatum))) & "-" & LTrim(str(Year(dDatum)))
End Function
ca**********@newcastle.gov.uk wrote:
Hi,

I am writing to a text file the records in an access table that is to
be loaded into an Oracle system.

However, I have been told that the date fields in the records I have
exported to the text file that are not compatible with oracle. The
format looks like: 01/01/2006 and I need it to look like 01-JAN-2006.

I have tried using the format function and the variable still shows it
as 01/01/2006.

The text file is generated by clicking from a button on a form which
contains the string/date variables and a loop with the write lines. I
am not on my work PC at the minute so can't show what I've created, but
can post it later if needed.

Can anyone give me an idea of how to get this sorted.

Cheers.

Jan 26 '06 #2
Thanks for the response. However it still returns the month as a
number and not in character form e.g. 24-11-2004 instead of 24-NOV-2004

Can you help again?

Cheers.
Gox wrote:
Try this function:

Function ToAmDate(dDatum As Variant) As Variant
If IsNull(dDatum) Then
ToAmDate = Null
Exit Function
End If
ToAmDate = LTrim(str(Day(dDatum))) & "-" &
LTrim(str(Month(dDatum))) & "-" & LTrim(str(Year(dDatum)))
End Function
ca**********@newcastle.gov.uk wrote:
Hi,

I am writing to a text file the records in an access table that is to
be loaded into an Oracle system.

However, I have been told that the date fields in the records I have
exported to the text file that are not compatible with oracle. The
format looks like: 01/01/2006 and I need it to look like 01-JAN-2006.

I have tried using the format function and the variable still shows it
as 01/01/2006.

The text file is generated by clicking from a button on a form which
contains the string/date variables and a loop with the write lines. I
am not on my work PC at the minute so can't show what I've created, but
can post it later if needed.

Can anyone give me an idea of how to get this sorted.

Cheers.


Jan 26 '06 #3
Gox
Try this:

Function ToAmDate(dDatum As Variant) As Variant
If IsNull(dDatum) Then
ToAmDate = Null
Exit Function
End If
ToAmDate = Format(CDate(dDatum), "dd-mmm-yyyy")
End Function

ca**********@newcastle.gov.uk wrote:
Thanks for the response. However it still returns the month as a
number and not in character form e.g. 24-11-2004 instead of 24-NOV-2004

Can you help again?

Cheers.

Jan 26 '06 #4
Works a treat.

Cheers.

Jan 26 '06 #5
ca**********@newcastle.gov.uk wrote:
Thanks for the response. However it still returns the month as a
number and not in character form e.g. 24-11-2004 instead of 24-NOV-2004


I'm curious as to why your Oracle admin isn't using that most basic of
Oracle concepts, the date picture.

Gox is giving you good functions, but in reality, you DON'T NEED THEM!!!!

to_date('column_with_access_date', 'dd/mm/yyyy')

To illustrate this, execute the following in SQL Plus (the Oracle guys
will know what this is):

SQL> select to_date('24/11/2004', 'dd/mm/yyyy') from dual;

TO_DATE('
---------
24-NOV-04

SQL>

A good Oracle admin should know how to use SQLLDR and a control file to
take your text file into Oracle. Part of the control file will use a
proper date picture to deal with any kind of date.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Jan 26 '06 #6

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

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
9
by: Neil | last post by:
I have been coding with ASP for some time now. I am using an ACCESS database. I am in the UK and wish to use DD/MM/YYYY format for dates. I have had no end of problems and possible solutions to...
2
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
5
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And...
4
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that...
2
by: Kakishev | last post by:
I have a problem at how best to convert a Date into a text field and keep the format dd/mmm/yyyy (01-FEB-2007). The problem is that dates are imported from SQL into an access front end Database....
6
by: tshad | last post by:
Apparently, I can't do: Dim da2 As New OleDb.OleDbDataAdapter("Select PR, Convert(varchar,getchar(),1),F1, F2, F5, Sum(F4) from temp .... I am getting this error. 'undefined function...
5
by: WPW07 | last post by:
Hello, We have several complex applications developed in Access 2003 by various outside consultants. These applications link to a variety of Oracle tables and are used only for Access reports. ...
1
by: magicscreen | last post by:
I am trying to create a CSV export file that has a date field. If you look at the table in Access the date looks like mm/dd/yyyy. I want to run the export wizard to create a spec so I can use it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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
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...

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.