Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8270595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:37:22+00:00 2026-06-08T06:37:22+00:00

I have a column in a csv file called created with values: 2012-04-16 14:46:42

  • 0

I have a column in a csv file called created with values:

2012-04-16 14:46:42
2012-06-16 12:40:52.653000000

I am trying to import this into Oracle 11gR2 with SQL Developer 3.1.07

I am using this as a format: RRRR-MM-DD HH24:MI:SS.FF

I get error input value not long enough for the date format

If I change the format to RRRR-MM-DD HH24:MI:SS I get error SQL Error: ORA-01830: date format picture ends before converting entire input string

How should I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:37:24+00:00Added an answer on June 8, 2026 at 6:37 am

    You have some dates and some timestamps. Such is the problem with importing data from systems with shonky data integrity.

    You have two options: clean the data before importing in or clean during importation.

    There are various different methods for cleaning the data beforehand. One option is to use a text processor or IDE which supports regular expressions, and do a search and replace to fix those values which lack the fractional seconds.

    The easiest way of cleansing during import is to use an external table as an intermediary (rather than SQL Loader). External tables are highly neat objects which allow us to manipulate structured data in OS files (such as CSV) as though it is in the database. The big advantage of external tables over SQL Loader is that we can use them in DML statements. Find out more.

    For this to work you will need to Define the external table with that column as a varchar2. You will also need to build a function which takes a string and converts it to a timestamp.

     create or replace function fix_ts (str in varchar2)
          return timestamp
     is
          is_a_date exception;
          pragma exception_init(is_a_date, -1840);
          rv timestamp;
     begin
          begin
               rv := to_timestamp(str);
          exception
                when is_a_date then
                     rv := to_timestamp(str)||'.000000000';
          end;
          return rv;
     end;
    

    Then you can insert the record int your target table like this:

     insert into target_table
          (id, created, whatever)
     select id
             , fix_ts(created)
             , whatever
     from external_table; 
    

    If this is a one-off data cleansing exercise then you’re probably better off munging the data in an IDE. If this is a regular data feed then it’s worth your while to build something more autonomous and robust.


    As per your comment there is a third option: to get the source system to fix the data during the export process. This can be easy or difficult, depending on many factors; quite often the political issues are harder to resolve than the technical ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day, I have a local csv file with values that change daily called
When I import a csv file into MySQL (phpmyadmin), for all integer values that
I have a file called test.csv, Data in the file is looking like this:
I have a stored procedure called sp_BulkInsert that inserts one .csv file into my
I have a three-column CSV file, like this: chips@food@f pizza@food@f tiger@animal@a fish@animal@a marshmallow@food@f New
I have an input CSV file with a column containing information similar to the
I have a csv file, and I want to extract the each column a
I have a CSV file. The first row will always contain column headers. Depending
I have a 4-column CSV file. I want to sort the lines, such that,
I have a large 2 column csv file (data.csv) with a weeks worth of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.