Archives of the TeradataForum
Message Posted: Mon, 23 Aug 1999 @ 18:56:53 GMT
OK, not to be left out, for smaller tables we use the following perl script. Note that we use it mostly for creating temp tables from Informix 'unload to 'foo' select * from 'table' ' commands. We haven't tested it on very large tables and don't really care about the speed (although seat of the pants it seems pretty fast). It assumes that you have the teraperl extensions loaded and the example assumes a 2 column table.
usage is: teraload <datafile
It would be trivial to have the perl script connect to the oracle database and get the records itself. However that's not what we wanted to do.
---- #!/usr/bin/perl -w # will read from stdin and insert each record into a *new* database use Sqlformat; # includes the teradata interface libary my $sess = ""; # session handle my @flds ; # where the field data is going my $table = "Eds_temp"; # the name of the table $sess = PCli::init("dbc", "database", "user", ""); # connect to the local database # create the table or die PCli::do( $sess, "CREATE table $table ( fld1 integer, fld2 integer ) " ) || die "Create table error '$PCli::errstr'"; # parse the input file reading lines and inserting into the database while(
|Copyright 2016 - All Rights Reserved|
|Last Modified: 23 Jun 2019|