Re: CSV From Oracle with timestamp column getting errors

From: Tim Cross <theophilusx(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: CSV From Oracle with timestamp column getting errors
Date: 2021-03-22 20:56:42
Message-ID: 87lfaeq4p0.fsf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Saha, Sushanta K" <sushanta(dot)saha(at)verizonwireless(dot)com> writes:

> \COPY table1 FROM '/tmp/Oracle_2020_06.csv' DELIMITER ',' CSV HEADER;
> ERROR: invalid input syntax for type timestamp: "01-JUN-20 06.04.20.634000 AM"
> CONTEXT: COPY table1, line 2, column last_update_timestamp: "01-JUN-20 06.04.20.634000 AM"
>

The problem is psql doesn't understand/recognise the timestamp format
being used in the CSV dump from Oracle.

Modify the SQL used to extract the data from Oracle so that it formats
the timestamp as a string which psql can parse into a timestamp type -
for example ISO or any of the psql timestamp formats (see psql manual).

--
Tim Cross

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Schanne 2021-03-22 22:24:48 MultiXactId wraparound and last aggressive vacuum time
Previous Message Victor Yegorov 2021-03-22 20:47:08 Re: CSV From Oracle with timestamp column getting errors