I would start by looking at DBI. Then make sure the database the information is in has a DBD::(your database here). Then a script can be written to extract the fields and with perl it can then be mangled as desired and output.

One option you didn't mention and may not have considered is that with DBI you can open 2 databases at once and read records out of one while writing the data into the other one. The databases of course can be completely different types

For example for Oracle to PostgreSQL you might go along these lines

use DBI; my $pgh=DBI->connect("DSN for Postgres here"); my $orh=DBI->connect("DSN for Oracle here"); #set up statments into variables for both eval{ my $psh=$pgh->prepare($write_stmt); my $osh=$orh->prepare($read_stmt); $osh->execute( variable list here ); $osh->bind_columns( \( $f1, $f2, $f3, ... ) ); while($osh->fetch) { $psh->execute( $f1, $f2, $f3, ... ); } $pgh->commit; } if($@) # error handler goes here { $pgh->rollback; print STDERR "Problem saving data\n"; }

Update: Fixed a type $pgh->execute should be $psh->execute. ie. use the statement handle not the DB handle for execute.


In reply to Re: Data export into text file by dga
in thread Data export into text file by b310

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.