|
|
Archives of the TeradataForum
Message Posted: Wed, 25 May 2011 @ 17:58:56 GMT
Subj: | | Perl script results in a blank output file |
|
From: | | JAMES PARK |
Esteemed Teradata users,
Thank you for your support.
I've tried to generate 'Create View' statements through a Perl script. The commands seem to work and generates an output file. But the output
file is blank and it has nothing in it. I don't know what went wrong.
C:\Users\JPARK>set TDLOGON=xxxxxx/xxxx,xxxxx
C:\Users\JPARK>xxxxxx.pl jparkstg.txt
C:\Users\JPARK>
- Beginning part of the Perl Script.
#---------------------------------------------------------------
# Generate views for ADHOC.
# J, Park on 2011-05-25.
#---------------------------------------------------------------
use Teradata::SQL qw(:all);
$outfile = shift;
die "Please specify output file" unless $outfile;
$tbls_db = 'ABCDEFG'; $views_db = 'ABCDEFG';
$dbh = Teradata::SQL::connect($ENV{'TDLOGON'})
or die "Please set TDLOGON. Could not connect";
@tlist = ();
while () { next if /^#/; chomp; push @tlist, $_; }
open(OUT, ">$outfile") or die "Could not open $outfile: $!";
foreach $tname (@tlist) {
warn "=== Table $tname ===\n";
@cols = list_cols("$tbls_db.$tname");
$vname = substr("ADHOC_$tname", 0,30);
.
.
.
| |