Re: COPy command question

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: sharmi_jo(at)yahoo(dot)com
Cc: General postgres mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: COPy command question
Date: 2009-02-12 18:35:01
Message-ID: dcc563d10902121035n6fa1012yae4246f56a6171b9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 11, 2009 at 11:22 AM, SHARMILA JOTHIRAJAH
<sharmi_jo(at)yahoo(dot)com> wrote:
> Hi,
> A question about the Postgresql's COPY command.
>
> This is the syntax of this command from the manual
>
> COPY tablename [ ( column [, ...] ) ]
> FROM { 'filename' | STDIN }
> [ [ WITH ]
> .....
> I want to migrate my tables from Oracle to Postgres.
> The COPY FROM command can take input from 'file' or 'STDIN'.
> Is it possible for the COPY command to take its input from a
> java program(which contains the oracle resultset) or any other way?

If that java program can provide direct input to postgresql then yes.
If everything has to be a prepared statement etc then no. Assuming
your java framework allows you just throw input at the database, you'd
be able to just give it the input line by line.

> I know I could get the Oracle rows in a csv format but
> Im trying to get it done without any file in between ?
>
> In short is it possible to use this 'COPY' command to migrate my tables'
> data from Oracle to Postgresql without using any file
> in between?

Sure, I can do it in PHP. I've done it in PHP. If your java
connectors have the facility to throw raw sql at pgsql then it should
work.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-02-12 19:05:25 Re: Killing OIDs
Previous Message Sam Mason 2009-02-12 18:17:02 Re: How to check if 2 series of data are equal