Re: Unloading ASCII delimited with Oracle6?

From: Brian Christensen <brianc_at_netcom.com>
Date: Fri, 25 Mar 1994 18:12:22 GMT
Message-ID: <briancCn8Fwn.K2H_at_netcom.com>


Greg Sheppard (gshep_at_eskimo.com) wrote:

: We've got an Oracle database with 134 tables. Is there an easy way
: other than a whole mess of sql statements to unload the tables in ascii
: pipe symbol delimited format?
 

: col1|col2|col3|
: col1|col2|col3|

You may want to investigate using oraperl. It would be fairly simple to write a program that would dump 134 files that contain all your tables. Here is a program I wrote to dump scott/tiger tables.

#!/usr/local/bin/oraperl

$lda = &ora_login("acht7", "scott", "tiger") || die $ora_errstr;

$csr1 = &ora_open($lda, "select table_name from user_tables")

    || die $ora_errstr;

while (($table_name) = &ora_fetch($csr1)) {

    $csr2 = &ora_open($lda, "select * from $table_name") || die $ora_errstr;     open(OUTPUT, ">${table_name}.dat") || die "Can't Open File";     while (_at_data = &ora_fetch($csr2))     {

        print OUTPUT join("|", _at_data), "\n";     }
 &ora_close($csr2) || die $ora_errstr;
}

Look at comp.lang.perl for information on perl.

Brian

-- 
                                             brianc_at_netcom.com
Received on Fri Mar 25 1994 - 19:12:22 CET

Original text of this message