Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    7

    Unanswered: Access to Oracle DATE FORMATTING

    I'm unfamiliar with Visual Basic code, but I need to select a date value (creation_date) from an Access database and insert it into Oracle within Visual Basic. Here's the code:

    "SELECT rtu_nb, rtu_name, type, service, creation_date " & _
    "FROM rtu WHERE service IN('com_sctm', 'com_dlms', 'com_fnp', 'com_iec', 'com_iec1107', 'com_vec') ORDER BY rtu_nb")

    "INSERT INTO C2000Rtu (rtu_nb, rtu_name, type, service, creation_date) " & _
    "VALUES (" & rs.Fields("rtu_nb").Value & ", '" & tmpRtuName & "'," & rs.Fields("type").Value & ", '" & rs.Fields("service").Value & "', '" & rs.Fields("creation_date").Value & "')"

    RTU is a table in Access Database, C2000Rtu is a table in Oracle Database. All these extra characters other than the field names is a bit confusing. So I don't know where/how to apply a function on creation_date. But basically, I'm getting errors because I think the date format is different. Any thoughts?
    Last edited by ezrasuncle; 02-04-04 at 04:57.

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    if you think the date has a problem because of format, then try addepting the format using the format function for the rs.Fields("creation_date").Value part

    which basicly is the same as rs!Creation_date but this reads better.

    Also to maximize readablity of your query try this:
    "INSERT INTO C2000Rtu (rtu_nb, rtu_name, type, service, creation_date) " & _
    "VALUES (" & rs!rtu_nb & _
    ", '" & tmpRtuName & _
    "'," & rs!type & _
    ", '" & rs!service" & _
    "', '" & rs!creation_date & "')"

    note that:
    Rtu_nb and type are numbers,
    All others are strings, including your creation_date. This may also be the source of your problem. Tho i am a bit foggy on my Oracle SQL....

    Good Luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •